validate path first before GET and HEAD
This commit is contained in:
parent
c682455d46
commit
1af297c537
1 changed files with 6 additions and 0 deletions
|
@ -20,6 +20,9 @@ handleRequest = ({ request }) ->
|
|||
|
||||
handleHEAD = (request) ->
|
||||
url = new URL request.url
|
||||
if url.pathname.endsWith "/"
|
||||
return new Response "Invalid URL",
|
||||
status: 404
|
||||
|
||||
resp = await s3.getObject url.pathname[1...], {}
|
||||
|
||||
|
@ -30,6 +33,9 @@ handleHEAD = (request) ->
|
|||
|
||||
handleGET = (request) ->
|
||||
url = new URL request.url
|
||||
if url.pathname.endsWith "/"
|
||||
return new Response "Invalid URL",
|
||||
status: 404
|
||||
|
||||
return await s3.getObject url.pathname[1...], {}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue