mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Preserve XML whitespace better when signing appcast feed (#2840)
We don't force pretty print when writing new XML data now when we insert a signing warning. This may mean the signing warning prefix may start on the same line as the first XML element, but I think this is alright since the rest of the warning starts on its own line.
This commit is contained in:
1 file changed
+3
-4
@@ -40,14 +40,14 @@ func addSignWarningToAppcast(data inputData: Data) -> Data {
|
||||
let signWarningPrefix = " sparkle-sign-warning:"
|
||||
let signWarningMessage = "\nIMPORTANT: This file was signed by Sparkle. Any modifications to this file requires re-signing this file with generate_appcast or sign_update! The signed signature will be embedded at the end of this file.\n"
|
||||
|
||||
let readOptions: XMLNode.Options = [
|
||||
let readAndWriteOptions: XMLNode.Options = [
|
||||
XMLNode.Options.nodeLoadExternalEntitiesNever,
|
||||
XMLNode.Options.nodePreserveCDATA,
|
||||
XMLNode.Options.nodePreserveWhitespace,
|
||||
]
|
||||
|
||||
do {
|
||||
let document = try XMLDocument(data: inputData, options: readOptions)
|
||||
let document = try XMLDocument(data: inputData, options: readAndWriteOptions)
|
||||
|
||||
var foundSignWarningComment: Bool = false
|
||||
if let documentChildren = document.children {
|
||||
@@ -66,8 +66,7 @@ func addSignWarningToAppcast(data inputData: Data) -> Data {
|
||||
newCommentNode.stringValue = newSigningWarningMessage
|
||||
document.insertChild(newCommentNode, at: 0)
|
||||
|
||||
let writeOptions: XMLNode.Options = [.nodeCompactEmptyElement, .nodePrettyPrint]
|
||||
xmlData = document.xmlData(options: writeOptions)
|
||||
xmlData = document.xmlData(options: readAndWriteOptions)
|
||||
} else {
|
||||
xmlData = inputData
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user