Skip to content

Commit

Permalink
Made the check for incorrectly typed opml more strict and clear
Browse files Browse the repository at this point in the history
  • Loading branch information
MarmadileManteater committed Feb 5, 2024
1 parent 7a91081 commit 9fd04d2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/renderer/components/data-settings/data-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,16 @@ export default defineComponent({
return
}
response.filePaths.forEach(filePath => {
// db and opml are the same mime type in android
if (textDecode.trim().startsWith('{') && filePath.endsWith('.opml')) {
filePath = filePath.split().splice(filePath.length - 5, 5, '.db'.split()).join()
}
if (filePath.endsWith('.csv')) {
this.importCsvYouTubeSubscriptions(textDecode)
// opml and db are the same mime type 🤷‍♀️
} else if ((textDecode.trim().startsWith('{') && filePath.endsWith('.opml')) || filePath.endsWith('.db')) {
} else if (filePath.endsWith('.db')) {
this.importFreeTubeSubscriptions(textDecode)
} else if (textDecode.trim().startsWith('<') && (filePath.endsWith('.opml') || filePath.endsWith('.xml'))) {
} else if (filePath.endsWith('.opml') || filePath.endsWith('.xml')) {
this.importOpmlYouTubeSubscriptions(textDecode)
} else if (filePath.endsWith('.json')) {
textDecode = JSON.parse(textDecode)
Expand Down Expand Up @@ -692,7 +696,10 @@ export default defineComponent({

response.filePaths.forEach(filePath => {
// db and opml are the same mime type in android
if (filePath.endsWith('.db') || filePath.endsWith('.opml')) {
if (textDecode.trim().startsWith('{') && filePath.endsWith('.opml')) {
filePath = filePath.split().splice(filePath.length - 5, 5, '.db'.split()).join()
}
if (filePath.endsWith('.db')) {
this.importFreeTubeHistory(textDecode.split('\n'))
} else if (filePath.endsWith('.json')) {
this.importYouTubeHistory(JSON.parse(textDecode))
Expand Down

0 comments on commit 9fd04d2

Please sign in to comment.