Skip to content

Commit 2332aaf

Browse files
fix csv import/export (#2247)
1 parent a5585af commit 2332aaf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/renderer/components/data-settings/data-settings.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ export default Vue.extend({
248248
return
249249
}
250250
const textDecode = new TextDecoder('utf-8').decode(data)
251-
const youtubeSubscriptions = textDecode.split('\n')
251+
const youtubeSubscriptions = textDecode.split('\n').filter(sub => {
252+
return sub !== ''
253+
})
252254
const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0]))
253255
const subscriptions = []
254256

@@ -855,7 +857,11 @@ export default Vue.extend({
855857
let exportText = 'Channel ID,Channel URL,Channel title\n'
856858
this.profileList[0].subscriptions.forEach((channel) => {
857859
const channelUrl = `https://www.youtube.com/channel/${channel.id}`
858-
exportText += `${channel.id},${channelUrl},${channel.name}\n`
860+
let channelName = channel.name
861+
if (channelName.search(',') !== -1) { // add quotations if channel has comma in name
862+
channelName = `"${channelName}"`
863+
}
864+
exportText += `${channel.id},${channelUrl},${channelName}\n`
859865
})
860866
exportText += '\n'
861867
const response = await this.showSaveDialog(options)

0 commit comments

Comments
 (0)