File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,41 @@ export class FileBackend implements StorageBackendAdapter {
100100 const lastModified = new Date ( 0 )
101101 lastModified . setUTCMilliseconds ( data . mtimeMs )
102102
103+ if ( headers ?. ifNoneMatch && headers . ifNoneMatch === eTag ) {
104+ return {
105+ metadata : {
106+ cacheControl : cacheControl || 'no-cache' ,
107+ mimetype : contentType || 'application/octet-stream' ,
108+ lastModified : lastModified ,
109+ httpStatusCode : 304 ,
110+ size : data . size ,
111+ eTag,
112+ contentLength : 0 ,
113+ } ,
114+ body : undefined ,
115+ httpStatusCode : 304 ,
116+ }
117+ }
118+
119+ if ( headers ?. ifModifiedSince ) {
120+ const ifModifiedSince = new Date ( headers . ifModifiedSince )
121+ if ( lastModified <= ifModifiedSince ) {
122+ return {
123+ metadata : {
124+ cacheControl : cacheControl || 'no-cache' ,
125+ mimetype : contentType || 'application/octet-stream' ,
126+ lastModified : lastModified ,
127+ httpStatusCode : 304 ,
128+ size : data . size ,
129+ eTag,
130+ contentLength : 0 ,
131+ } ,
132+ body : undefined ,
133+ httpStatusCode : 304 ,
134+ }
135+ }
136+ }
137+
103138 if ( headers ?. range ) {
104139 const parts = headers . range . replace ( / b y t e s = / , '' ) . split ( '-' )
105140 const startRange = parseInt ( parts [ 0 ] , 10 )
You can’t perform that action at this time.
0 commit comments