mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 11:07:08 +00:00
Recover from feed XML parsing error
This commit is contained in:
@@ -82,9 +82,23 @@ export default {
|
|||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Try to fix idiosyncrasies and XML bugs in the source.
|
||||||
|
*/
|
||||||
|
fixText (text) {
|
||||||
|
// Of course this will fail if there happens to be an </hr>
|
||||||
|
// element in the source.
|
||||||
|
return text.replace(/(<hr( [^>]*)?>)/g, "$1</hr>")
|
||||||
|
},
|
||||||
|
|
||||||
async refresh () {
|
async refresh () {
|
||||||
const text = await this.api([`/rss/?remote=${atob(this.$route.params.source)}`, {text:true}]);
|
const text = await this.api([`/rss/?remote=${atob(this.$route.params.source)}`, {text:true}]);
|
||||||
this.feed = this.parse(text);
|
try {
|
||||||
|
this.feed = this.parse(text);
|
||||||
|
} catch (err) {
|
||||||
|
// If it failed to parse, try once again with some
|
||||||
|
// tweaks to address known feed bugs.
|
||||||
|
this.feed = this.parse(this.fixText(text));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
...mapActions(["api"])
|
...mapActions(["api"])
|
||||||
|
|||||||
Reference in New Issue
Block a user