fix csv import/export (#2247)

This commit is contained in:
ChunkyProgrammer 2022-05-25 04:28:18 -04:00 committed by GitHub
parent a5585afa18
commit 2332aafd68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -248,7 +248,9 @@ export default Vue.extend({
return return
} }
const textDecode = new TextDecoder('utf-8').decode(data) const textDecode = new TextDecoder('utf-8').decode(data)
const youtubeSubscriptions = textDecode.split('\n') const youtubeSubscriptions = textDecode.split('\n').filter(sub => {
return sub !== ''
})
const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0])) const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0]))
const subscriptions = [] const subscriptions = []
@ -855,7 +857,11 @@ export default Vue.extend({
let exportText = 'Channel ID,Channel URL,Channel title\n' let exportText = 'Channel ID,Channel URL,Channel title\n'
this.profileList[0].subscriptions.forEach((channel) => { this.profileList[0].subscriptions.forEach((channel) => {
const channelUrl = `https://www.youtube.com/channel/${channel.id}` const channelUrl = `https://www.youtube.com/channel/${channel.id}`
exportText += `${channel.id},${channelUrl},${channel.name}\n` let channelName = channel.name
if (channelName.search(',') !== -1) { // add quotations if channel has comma in name
channelName = `"${channelName}"`
}
exportText += `${channel.id},${channelUrl},${channelName}\n`
}) })
exportText += '\n' exportText += '\n'
const response = await this.showSaveDialog(options) const response = await this.showSaveDialog(options)