mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-16 12:18:19 +01: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:
@@ -315,7 +315,14 @@ class GenericWebProvider implements InfoProviderInterface
|
||||
//Remove any leading slashes
|
||||
$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
|
||||
|
||||
Reference in New Issue
Block a user