Auto-correct S3 hostname

This PR updates the S3 backend to automatically remove leading and trailing `/` characters so upgrades are less likely to encounter the error, as the previous version did not fail on such hostnames.

The check still captures cases where the user attempts to input a path or URL into the hostname field.
This commit is contained in:
Kenneth Skovhede
2025-11-02 09:07:12 +01:00
parent 7fd16ff941
commit b4e80abab1
@@ -249,6 +249,7 @@ namespace Duplicati.Library.Backend
options["s3-ext-forcepathstyle"] = "true";
// Validate that hostname doesn't contain a path
hostname = hostname.Trim('/').Trim('\\');
if (hostname.Contains('/') || hostname.Contains('\\'))
throw new UserInformationException(Strings.S3Backend.NoPathAllowedInEndpointError, "S3NoPathInEndpoint");