Merge branch 'master' into ui-separation-and-xpc

This commit is contained in:
Zorg committed 2017-01-12 21:13:24 -05:00
commit 6a4f1e6340
2 files changed
+11 -5

No files matched your search

+7 -4
View File
@@ -98,11 +98,14 @@ class ArchiveItem: CustomStringConvertible {
return "\(self.archivePath) \(self.version)"
}
var archiveURL: URL {
if let relative = self.feedURL {
return URL(string: self.archivePath.lastPathComponent, relativeTo: relative)!
var archiveURL: URL? {
guard let escapedFilename = self.archivePath.lastPathComponent.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
return nil;
}
return URL(string: self.archivePath.lastPathComponent)!
if let relative = self.feedURL {
return URL(string: escapedFilename, relativeTo: relative)
}
return URL(string: escapedFilename)
}
var pubDate : String {
+4 -1
View File
@@ -117,8 +117,11 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
item.addChild(enclosure!);
}
guard let archiveURL = update.archiveURL?.absoluteString else {
throw makeError(code: .appcastError, "Bad archive name or feed URL");
};
var attributes = [
XMLNode.attribute(withName: "url", stringValue: update.archiveURL.absoluteString) as! XMLNode,
XMLNode.attribute(withName: "url", stringValue: archiveURL) as! XMLNode,
XMLNode.attribute(withName: "sparkle:version", uri: sparkleNS, stringValue: update.version) as! XMLNode,
XMLNode.attribute(withName: "length", stringValue: String(update.fileSize)) as! XMLNode,
XMLNode.attribute(withName: "type", stringValue: update.mimeType) as! XMLNode,