@@ -41,28 +41,41 @@ async function uploadStatics(versionId, basePath, currentPath = '') {
41
41
const fileStat = await promisify ( fs . stat ) ( fullFilePath ) ;
42
42
43
43
if ( fileStat . isFile ( ) ) {
44
- const fileContent = await promisify ( fs . readFile ) ( fullFilePath , 'utf8' ) ;
44
+ const fileContent = await promisify ( fs . readFile ) ( fullFilePath ) ;
45
45
const mimeType = mime . lookup ( fullFilePath ) ;
46
46
const staticPath = path . join ( currentPath , filePath ) . replace ( / \\ / g, '/' ) ;
47
47
48
48
try {
49
- const response = await StorageService . upload ( versionId , fileContent , staticPath , mimeType ) ;
49
+ const response = await StorageService . upload (
50
+ versionId ,
51
+ fileContent ,
52
+ staticPath ,
53
+ mimeType ,
54
+ ) ;
50
55
if ( response . statusText === 'OK' ) {
51
56
successUploadCount += 1 ;
52
57
feedback . statics . success (
53
58
Messages . platform . storage . success . file_uploaded_success ( filePath ) ,
54
59
) ;
55
60
}
56
- if ( ! response . status === 'OK' ) { throw new Error ( response ) ; }
61
+ if ( ! response . status === 'OK' ) {
62
+ throw new Error ( response ) ;
63
+ }
57
64
} catch ( error ) {
58
- feedback . statics . error ( Messages . platform . storage . errors . file_upload_failed ( filePath ) ) ;
65
+ feedback . statics . error (
66
+ Messages . platform . storage . errors . file_upload_failed ( filePath ) ,
67
+ ) ;
59
68
debug . error ( error ) ;
60
69
}
61
70
} else if ( fileStat . isDirectory ( ) ) {
62
71
const subDirPath = path . join ( currentPath , filePath ) ;
63
- const subDirFiles = await promisify ( fs . readdir ) ( path . join ( basePath , subDirPath ) ) ;
72
+ const subDirFiles = await promisify ( fs . readdir ) (
73
+ path . join ( basePath , subDirPath ) ,
74
+ ) ;
64
75
65
- await Promise . all ( subDirFiles . map ( ( file ) => uploadFiles ( path . join ( subDirPath , file ) ) ) ) ;
76
+ await Promise . all (
77
+ subDirFiles . map ( ( file ) => uploadFiles ( path . join ( subDirPath , file ) ) ) ,
78
+ ) ;
66
79
}
67
80
}
68
81
@@ -75,7 +88,9 @@ async function uploadStatics(versionId, basePath, currentPath = '') {
75
88
}
76
89
77
90
feedback . statics . success (
78
- Messages . platform . storage . success . statics_uploaded_finish ( successUploadCount ) ,
91
+ Messages . platform . storage . success . statics_uploaded_finish (
92
+ successUploadCount ,
93
+ ) ,
79
94
) ;
80
95
return successUploadCount ;
81
96
}
0 commit comments