@@ -30,6 +30,7 @@ class VaultAPIv1 extends APIHandler {
30
30
}
31
31
32
32
async onGetExport ( req , res , next ) {
33
+ const perm644 = parseInt ( '0644' , 8 ) ;
33
34
delete req . query [ 'offset' ] ;
34
35
delete req . query [ 'limit' ] ;
35
36
@@ -42,18 +43,18 @@ class VaultAPIv1 extends APIHandler {
42
43
res . attachment ( `${ topdir } .zip` ) ;
43
44
44
45
const csvdoc = await exputil . csvDoc ( { rows, tzoffset} ) ;
45
- zip . addFile ( `${ topdir } /messages-csv.csv` , new Buffer ( csvdoc ) , " CSV for selected messages" ) ;
46
+ zip . addFile ( `${ topdir } /messages-csv.csv` , new Buffer ( csvdoc ) , ' CSV for selected messages' , perm644 ) ;
46
47
47
48
const htmldoc = exputil . htmlDoc ( { query : req . query , exportDate : exputil . offsetTimeStr ( moment ( ) , tzoffset ) , rows, tzoffset} ) ;
48
- zip . addFile ( `${ topdir } /messages-html.html` , new Buffer ( htmldoc ) , " HTML for selected messages" ) ;
49
+ zip . addFile ( `${ topdir } /messages-html.html` , new Buffer ( htmldoc ) , ' HTML for selected messages' , perm644 ) ;
49
50
50
51
const jsondoc = exputil . jsonDoc ( { query : req . query , exportDate : exputil . offsetTimeStr ( moment ( ) , tzoffset ) , rows, tzoffset} ) ;
51
- zip . addFile ( `${ topdir } /messages-json.json` , new Buffer ( jsondoc ) , " JSON for selected messages" ) ;
52
+ zip . addFile ( `${ topdir } /messages-json.json` , new Buffer ( jsondoc ) , ' JSON for selected messages' , perm644 ) ;
52
53
53
54
for ( const row of rows ) {
54
55
const attachments = await this . fetchAttachments ( row ) ;
55
56
for ( const a of attachments ) {
56
- zip . addFile ( `${ topdir } /attachments/${ row . messageId } /${ a . id } /${ a . attachment . name } ` , a . attachment . data , " attachment" ) ;
57
+ zip . addFile ( `${ topdir } /attachments/${ row . messageId } /${ a . id } /${ a . attachment . name } ` , a . attachment . data , 'message attachment' , perm644 ) ;
57
58
}
58
59
}
59
60
0 commit comments