Suffix .json on micro.blog feed finds that return a 404. Issue #329
This commit is contained in:
parent
b9ccd5aabb
commit
56d6bc91e3
|
@ -15,8 +15,17 @@ class FeedFinder {
|
||||||
|
|
||||||
static func find(url: URL, completion: @escaping (Result<Set<FeedSpecifier>, Error>) -> Void) {
|
static func find(url: URL, completion: @escaping (Result<Set<FeedSpecifier>, Error>) -> Void) {
|
||||||
downloadAddingToCache(url) { (data, response, error) in
|
downloadAddingToCache(url) { (data, response, error) in
|
||||||
|
|
||||||
if response?.forcedStatusCode == 404 {
|
if response?.forcedStatusCode == 404 {
|
||||||
completion(.failure(AccountError.createErrorNotFound))
|
if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), urlComponents.host == "micro.blog" {
|
||||||
|
urlComponents.path = "\(urlComponents.path).json"
|
||||||
|
if let newURLString = urlComponents.url?.absoluteString {
|
||||||
|
let microblogFeedSpecifier = FeedSpecifier(title: nil, urlString: newURLString, source: .HTMLLink)
|
||||||
|
completion(.success(Set([microblogFeedSpecifier])))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
completion(.failure(AccountError.createErrorNotFound))
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue