fix serving files with numbers in extension (#931)

pull/905/head
onespaceman 2024-07-11 16:37:58 -04:00 committed by GitHub
parent 70d8a36e88
commit be8c3303a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -489,7 +489,7 @@ export class HttpServer {
} }
}); });
const filePathRegex = "/:path{[^!].*\\.[a-zA-Z]+}"; const filePathRegex = "/:path{[^!].*\\.[a-zA-Z0-9]+}";
const mdExt = ".md"; const mdExt = ".md";
this.app.get(filePathRegex, async (c) => { this.app.get(filePathRegex, async (c) => {

View File

@ -103,7 +103,7 @@ self.addEventListener("fetch", (event: any) => {
pathname === "/index.json" pathname === "/index.json"
) { ) {
return fetch(request); return fetch(request);
} else if (/\/.+\.[a-zA-Z]+$/.test(pathname)) { } else if (/\/.+\.[a-zA-Z0-9]+$/.test(pathname)) {
// If this is a /*.* request, this can either be a plug worker load or an attachment load // If this is a /*.* request, this can either be a plug worker load or an attachment load
return handleLocalFileRequest(request, pathname); return handleLocalFileRequest(request, pathname);
} else { } else {