mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Allow URLs with multiple leading slashes.
Fixes https://github.com/solid/community-server/issues/1025
This commit is contained in:
@@ -45,12 +45,11 @@ export class OriginalUrlExtractor extends TargetExtractor {
|
||||
}
|
||||
|
||||
// URL object applies punycode encoding to domain
|
||||
const base = `${protocol}://${host}`;
|
||||
const originalUrl = new URL(toCanonicalUriPath(url), base);
|
||||
|
||||
// Drop the query string if requested
|
||||
if (!this.includeQueryString) {
|
||||
originalUrl.search = '';
|
||||
const originalUrl = new URL(`${protocol}://${host}`);
|
||||
const [ , pathname, search ] = /^([^?]*)(.*)/u.exec(toCanonicalUriPath(url))!;
|
||||
originalUrl.pathname = pathname;
|
||||
if (this.includeQueryString && search) {
|
||||
originalUrl.search = search;
|
||||
}
|
||||
|
||||
return { path: originalUrl.href };
|
||||
|
||||
Reference in New Issue
Block a user