From de371877b906de749ca30495b0404c857e5ced70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 15 Mar 2026 18:55:16 +0100 Subject: [PATCH] Make GenericWebProvider more forgiving with URLs and accept the "fixed" strings traefik provides as security measure This fixes issue #1296 --- .../InfoProviderSystem/Providers/GenericWebProvider.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Services/InfoProviderSystem/Providers/GenericWebProvider.php b/src/Services/InfoProviderSystem/Providers/GenericWebProvider.php index bd6d30e6..e20264b3 100644 --- a/src/Services/InfoProviderSystem/Providers/GenericWebProvider.php +++ b/src/Services/InfoProviderSystem/Providers/GenericWebProvider.php @@ -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