@@ -36,7 +36,8 @@ import {
3636 withAuthorization ,
3737 withBlob ,
3838 withWorkspace ,
39- withReadonly
39+ withReadonly ,
40+ withOptionalAuth
4041} from './middleware'
4142import {
4243 handleBlobDelete ,
@@ -176,13 +177,33 @@ export async function createServer (
176177
177178 app . get ( '/blob/:workspace' , withAdminAuthorization , withWorkspace , wrapRequest ( ctx , 'listBlobs' , handleBlobList ) )
178179
179- app . head ( '/blob/:workspace/:name' , withBlob , wrapRequest ( ctx , 'headBlob' , handleBlobHead ) )
180+ app . head (
181+ '/blob/:workspace/:name' ,
182+ withOptionalAuth ( config . Secure ) ,
183+ withBlob ,
184+ wrapRequest ( ctx , 'headBlob' , handleBlobHead )
185+ )
180186
181- app . head ( '/blob/:workspace/:name/:filename' , withBlob , wrapRequest ( ctx , 'headBlob' , handleBlobHead ) )
187+ app . head (
188+ '/blob/:workspace/:name/:filename' ,
189+ withOptionalAuth ( config . Secure ) ,
190+ withBlob ,
191+ wrapRequest ( ctx , 'headBlob' , handleBlobHead )
192+ )
182193
183- app . get ( '/blob/:workspace/:name' , withBlob , wrapRequest ( ctx , 'getBlob' , handleBlobGet ) )
194+ app . get (
195+ '/blob/:workspace/:name' ,
196+ withOptionalAuth ( config . Secure ) ,
197+ withBlob ,
198+ wrapRequest ( ctx , 'getBlob' , handleBlobGet )
199+ )
184200
185- app . get ( '/blob/:workspace/:name/:filename' , withBlob , wrapRequest ( ctx , 'getBlob' , handleBlobGet ) )
201+ app . get (
202+ '/blob/:workspace/:name/:filename' ,
203+ withOptionalAuth ( config . Secure ) ,
204+ withBlob ,
205+ wrapRequest ( ctx , 'getBlob' , handleBlobGet )
206+ )
186207
187208 app . delete ( '/blob/:workspace/:name' , withAuthorization , withBlob , wrapRequest ( ctx , 'deleteBlob' , handleBlobDelete ) )
188209
@@ -206,7 +227,12 @@ export async function createServer (
206227
207228 // Blob meta
208229
209- app . get ( '/meta/:workspace/:name' , withBlob , wrapRequest ( ctx , 'getMeta' , handleMetaGet ) )
230+ app . get (
231+ '/meta/:workspace/:name' ,
232+ withOptionalAuth ( config . Secure ) ,
233+ withBlob ,
234+ wrapRequest ( ctx , 'getMeta' , handleMetaGet )
235+ )
210236
211237 app . put ( '/meta/:workspace/:name' , withAuthorization , withBlob , wrapRequest ( ctx , 'putMeta' , handleMetaPut ) )
212238
0 commit comments