File tree Expand file tree Collapse file tree 1 file changed +24
-11
lines changed Expand file tree Collapse file tree 1 file changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -92,17 +92,30 @@ if (deploy) {
9292 const ContentType = mimeTypes [ extname ( file . name ) ] ;
9393 console . log ( file . name , ContentType ) ;
9494 const Body = await readFile ( joinPath ( destDir , file . name ) ) ;
95- await s3 . send (
96- new PutObjectCommand ( {
97- Bucket,
98- Key : file . name ,
99- CacheControl : 'public,max-age=15552000,immutable' ,
100- ContentType,
101- IfNoneMatch : '*' ,
102- Body,
103- ChecksumAlgorithm : 'SHA256' ,
104- } )
105- ) ;
95+ await s3
96+ . send (
97+ new PutObjectCommand ( {
98+ Bucket,
99+ Key : file . name ,
100+ CacheControl : 'public,max-age=15552000,immutable' ,
101+ ContentType,
102+ IfNoneMatch : '*' ,
103+ Body,
104+ ChecksumAlgorithm : 'SHA256' ,
105+ } )
106+ )
107+ . catch ( ( e ) => {
108+ if (
109+ typeof e === 'object' &&
110+ e !== null &&
111+ e . Code === 'PreconditionFailed' &&
112+ e . Condition === 'If-None-Match'
113+ ) {
114+ console . info ( 'already exists' ) ;
115+ } else {
116+ throw e ;
117+ }
118+ } ) ;
106119 }
107120 }
108121 console . log ( 'index.html' ) ;
You can’t perform that action at this time.
0 commit comments