This commit is contained in:
Aber 2024-03-02 13:51:34 +08:00 committed by GitHub
parent 9450ba3577
commit 11d1825dae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -611,7 +611,10 @@ export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> { async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
const { bucket } = env; const { bucket } = env;
if (request.headers.get('Authorization') !== `Basic ${btoa(`${env.USERNAME}:${env.PASSWORD}`)}`) { if (
request.method !== 'OPTIONS'
&& request.headers.get('Authorization') !== `Basic ${btoa(`${env.USERNAME}:${env.PASSWORD}`)}`
) {
return new Response('Unauthorized', { return new Response('Unauthorized', {
status: 401, status: 401,
headers: { headers: {