From 2332aafd68834e421bec8c75977b3dd12691f62f Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Wed, 25 May 2022 04:28:18 -0400 Subject: [PATCH] fix csv import/export (#2247) --- src/renderer/components/data-settings/data-settings.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/data-settings/data-settings.js b/src/renderer/components/data-settings/data-settings.js index ef3f507c..96c78d76 100644 --- a/src/renderer/components/data-settings/data-settings.js +++ b/src/renderer/components/data-settings/data-settings.js @@ -248,7 +248,9 @@ export default Vue.extend({ return } 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 subscriptions = [] @@ -855,7 +857,11 @@ export default Vue.extend({ let exportText = 'Channel ID,Channel URL,Channel title\n' this.profileList[0].subscriptions.forEach((channel) => { 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' const response = await this.showSaveDialog(options)