mirror of https://github.com/readrops/Readrops.git
Handle the absence of some tags in RSS2 and ATOM feeds
This commit is contained in:
parent
4b999e9fd6
commit
838768800a
|
@ -102,6 +102,8 @@ class LocalRSSDataSource(private val httpClient: OkHttpClient) {
|
|||
adapter.fromJson(Buffer().readFrom(stream))!!
|
||||
}
|
||||
|
||||
handleSpecialCases(feed, type, response)
|
||||
|
||||
feed.etag = response.header(LibUtils.ETAG_HEADER)
|
||||
feed.lastModified = response.header(LibUtils.LAST_MODIFIED_HEADER)
|
||||
|
||||
|
@ -122,4 +124,15 @@ class LocalRSSDataSource(private val httpClient: OkHttpClient) {
|
|||
adapter.fromJson(Buffer().readFrom(stream))!!
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleSpecialCases(feed: Feed, type: LocalRSSHelper.RSSType, response: Response) {
|
||||
with(feed) {
|
||||
if (type == LocalRSSHelper.RSSType.RSS_2) {
|
||||
if (url == null) url = response.request.url.toString()
|
||||
} else if (type == LocalRSSHelper.RSSType.ATOM) {
|
||||
if (url == null) url = response.request.url.toString()
|
||||
if (siteUrl == null) siteUrl = response.request.url.scheme + "://" + response.request.url.host
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue