mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-18 05:09:36 +00:00
Make GenericWebProvider more forgiving with URLs and accept the "fixed" strings traefik provides as security measure
This fixes issue #1296
This commit is contained in:
parent
baeef1228a
commit
de371877b9
1 changed files with 8 additions and 1 deletions
|
|
@ -315,7 +315,14 @@ class GenericWebProvider implements InfoProviderInterface
|
||||||
//Remove any leading slashes
|
//Remove any leading slashes
|
||||||
$url = ltrim($url, '/');
|
$url = ltrim($url, '/');
|
||||||
|
|
||||||
$url = 'https://'.$url;
|
//If the URL starts with https:/ or http:/, add the missing slash
|
||||||
|
//Traefik removes the double slash as secruity measure, so we want to be forgiving and add it back if needed
|
||||||
|
//See https://github.com/Part-DB/Part-DB-server/issues/1296
|
||||||
|
if (preg_match('/^https?:\/[^\/]/', $url)) {
|
||||||
|
$url = preg_replace('/^(https?:)\/([^\/])/', '$1//$2', $url);
|
||||||
|
} else {
|
||||||
|
$url = 'https://'.$url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//If this is not a valid URL with host, domain and path, throw an exception
|
//If this is not a valid URL with host, domain and path, throw an exception
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue