Don’t write "Untitled" to Subscriptions.opml when a feed lacks a name or editedName — “Untitled” is a localizable, display-only string, not something to store in OPML. Fix #527.

This commit is contained in:
Brent Simmons 2019-02-06 21:18:22 -08:00
parent aadf4ec09f
commit eb3c69f4d0
1 changed files with 12 additions and 2 deletions

View File

@ -231,8 +231,18 @@ public final class Feed: DisplayNameProvider, Renamable, UnreadCountProvider, Ha
extension Feed: OPMLRepresentable {
public func OPMLString(indentLevel: Int) -> String {
// https://github.com/brentsimmons/NetNewsWire/issues/527
// Dont use nameForDisplay because that can result in a feed name "Untitled" written to disk,
// which NetNewsWire may take later to be the actual name.
var nameToUse = editedName
if nameToUse == nil {
nameToUse = name
}
if nameToUse == nil {
nameToUse = ""
}
let escapedName = nameToUse!.rs_stringByEscapingSpecialXMLCharacters()
let escapedName = nameForDisplay.rs_stringByEscapingSpecialXMLCharacters()
var escapedHomePageURL = ""
if let homePageURL = homePageURL {
escapedHomePageURL = homePageURL.rs_stringByEscapingSpecialXMLCharacters()