http: URL pattern matcher fixes.
This commit is contained in:
23
core/core.js
23
core/core.js
@ -918,19 +918,6 @@ async function useAppHandler(
|
||||
* @returns
|
||||
*/
|
||||
async function blobHandler(request, response, blobId, uri) {
|
||||
if (!uri) {
|
||||
response.writeHead(303, {
|
||||
Location:
|
||||
(request.client.tls ? 'https://' : 'http://') +
|
||||
(request.headers['x-forwarded-host'] ?? request.headers.host) +
|
||||
blobId +
|
||||
'/',
|
||||
'Content-Length': '0',
|
||||
});
|
||||
response.end();
|
||||
return;
|
||||
}
|
||||
|
||||
let process;
|
||||
let data;
|
||||
let match;
|
||||
@ -1072,13 +1059,15 @@ loadSettings()
|
||||
httpd.set_http_redirect(settings.http_redirect);
|
||||
}
|
||||
httpd.all('/app/socket', app.socket);
|
||||
httpd.all('', function default_http_handler(request, response) {
|
||||
httpd.all('/~{word}/{word}/*', function default_http_handler(request, response) {
|
||||
let match;
|
||||
if ((match = /^(\/~[^\/]+\/[^\/]+)(\/?.*)$/.exec(request.uri))) {
|
||||
return blobHandler(request, response, match[1], match[2]);
|
||||
} else if (
|
||||
(match = /^\/([&\%][^\.]{44}(?:\.\w+)?)(\/?.*)/.exec(request.uri))
|
||||
) {
|
||||
}
|
||||
});
|
||||
httpd.all('/&*.sha256/*', function default_http_handler(request, response) {
|
||||
let match;
|
||||
if ((match = /^\/([&\%][^\.]{44}(?:\.\w+)?)(\/?.*)/.exec(request.uri))) {
|
||||
return blobHandler(request, response, match[1], match[2]);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user