mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Handle relative <link> elements in Atom parser — use xml:base when present to resolve. Add test case.
This commit is contained in:
@@ -109,4 +109,22 @@ final class AtomParserTests: XCTestCase {
|
||||
XCTAssertNotEqual(article.title, "Default Title")
|
||||
}
|
||||
}
|
||||
|
||||
func testLinkElementsWithRelativeURLs() {
|
||||
|
||||
// This feed has <link> elements that look like this…
|
||||
// <link href="/en/publish/2022/07/01/great-moments-in-document-history-reimagining-the-declaration-of-independence-as-pdf"/>
|
||||
// …and it also has, in the feed declaration…
|
||||
// xml:base="https://blog.adobe.com"
|
||||
// …and so the <link> values should be parsed as (for example):
|
||||
// https://blog.adobe.com/en/publish/2022/07/01/great-moments-in-document-history-reimagining-the-declaration-of-independence-as-pdf
|
||||
// Issue: https://github.com/Ranchero-Software/NetNewsWire/issues/3662
|
||||
|
||||
let d = parserData("adobe", "atom", "https://blog.adobe.com/feed.xml")
|
||||
let parsedFeed = try! FeedParser.parse(d)!
|
||||
|
||||
for article in parsedFeed.items {
|
||||
XCTAssertTrue(article.url!.hasPrefix("https://blog.adobe.com/en/publish/20"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
Modules/Parser/Tests/ParserTests/Resources/adobe.atom
Normal file
1
Modules/Parser/Tests/ParserTests/Resources/adobe.atom
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user