File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const settings = require('util/settings/settings.js')
3
3
const PasswordManagers = require ( 'passwordManager/passwordManager.js' )
4
4
const modalMode = require ( 'modalMode.js' )
5
5
const { ipcRenderer } = require ( 'electron' )
6
+ const papaparse = require ( 'papaparse' )
6
7
7
8
const passwordViewer = {
8
9
container : document . getElementById ( 'password-viewer' ) ,
@@ -178,8 +179,14 @@ const passwordViewer = {
178
179
manager . getAllCredentials ( ) . then ( function ( credentials ) {
179
180
if ( credentials . length === 0 ) return
180
181
181
- const header = 'url,username,password\n'
182
- const csvData = header + credentials . map ( credential => `https://${ credential . domain } ,${ credential . username } ,${ credential . password } ` ) . join ( '\n' )
182
+ const csvData = papaparse . unparse ( {
183
+ fields : [ 'url' , 'username' , 'password' ] ,
184
+ data : credentials . map ( credential => [
185
+ `https://${ credential . domain } ` ,
186
+ credential . username ,
187
+ credential . password
188
+ ] )
189
+ } )
183
190
const blob = new Blob ( [ csvData ] , { type : 'text/csv' } )
184
191
const url = URL . createObjectURL ( blob )
185
192
const anchor = document . createElement ( 'a' )
You can’t perform that action at this time.
0 commit comments