mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 18:55:19 -04:00
fix: remove subpath support for HD_BASE_URL
With this commit we drop the subpath support which results in the constraint that HedgeDoc must always run on the root of a domain. This makes a lot of things in testing, rendering and security much easier. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
7401791ec8
commit
dccd58f0c1
32 changed files with 111 additions and 116 deletions
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { MissingTrailingSlashError, WrongProtocolError } from './errors.js'
|
||||
import { NoSubdirectoryAllowedError, WrongProtocolError } from './errors.js'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ import { Optional } from '@mrdrogdrog/optional'
|
|||
* @param {String | undefined} url the raw url
|
||||
* @return An {@link Optional} that contains the parsed URL or is empty if the raw value isn't a valid URL
|
||||
* @throws WrongProtocolError if the protocol of the URL isn't either http nor https
|
||||
* @throws MissingTrailingSlashError if the URL has a path that doesn't end with a trailing slash
|
||||
* @throws NoSubdirectoryAllowedError if the URL has a path that doesn't end with a trailing slash
|
||||
*/
|
||||
export function parseUrl(url: string | undefined): Optional<URL> {
|
||||
return createOptionalUrl(url)
|
||||
|
@ -21,8 +21,8 @@ export function parseUrl(url: string | undefined): Optional<URL> {
|
|||
() => new WrongProtocolError()
|
||||
)
|
||||
.guard(
|
||||
(value) => value.pathname.endsWith('/'),
|
||||
() => new MissingTrailingSlashError()
|
||||
(value) => value.pathname === '/',
|
||||
() => new NoSubdirectoryAllowedError()
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue