Skip to content

Commit

Permalink
redirect to 404 if error
Browse files Browse the repository at this point in the history
  • Loading branch information
NiceygyLive committed Oct 20, 2023
1 parent 127be74 commit 19ffc1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "DownloadRecorder",
"version": "0.0.0",
"version": "1.1.0",
"private": true,
"scripts": {
"deploy": "wrangler publish",
"deploy": "wrangler deploy",
"start": "wrangler dev"
},
"devDependencies": {
Expand Down
9 changes: 8 additions & 1 deletion src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ export default {
console.log("Handling request for " + url);
const packNameRaw = url.split("/reder?url=")[1]; //pack name will include username, e.g niceygylive/example
const fileName = url.split("?file=")[1]; //e.g V1.1.2/download.zip
const packName = packNameRaw.split("?file=")[0]; //e.g niceygylive/example
var packName = packNameRaw.split("?file=")[0]; //e.g niceygylive/example
if (packName == undefined | fileName == undefined) {
console.log("Invalid request, redirecting to 404")
await response.redirect(
"https://thealiendoctor.com/404", 301
);

}
console.log("Parsed! Pack name is " + packName + " and file name is " + fileName);

var oldNum = await KV.get(packName);
Expand Down

0 comments on commit 19ffc1a

Please sign in to comment.