diff --git a/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs b/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs index ece998eec..20fb55dd7 100644 --- a/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs +++ b/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs @@ -37,7 +37,9 @@ namespace BTCPayServer.Storage.Services.Providers.FileSystemStorage public override async Task GetFileUrl(Uri baseUri, StoredFile storedFile, StorageSettings configuration) { var baseResult = await base.GetFileUrl(baseUri, storedFile, configuration); - var url = new Uri(baseUri, LocalStorageDirectoryName); + // Set the relative URL to the directory name if the root path is default, otherwise add root path before the directory name + var relativeUrl = baseUri.AbsolutePath == "/" ? LocalStorageDirectoryName : $"{baseUri.AbsolutePath}/{LocalStorageDirectoryName}"; + var url = new Uri(baseUri, relativeUrl); return baseResult.Replace(new DirectoryInfo(_datadirs.Value.StorageDir).FullName, url.AbsoluteUri, StringComparison.InvariantCultureIgnoreCase); } diff --git a/BTCPayServer/Views/Server/Files.cshtml b/BTCPayServer/Views/Server/Files.cshtml index f304aa7f9..71f6fac30 100644 --- a/BTCPayServer/Views/Server/Files.cshtml +++ b/BTCPayServer/Views/Server/Files.cshtml @@ -64,13 +64,13 @@ else @Url.Action("GetFile", "Storage", new { fileId = Model.SelectedFileId - }, Context.Request.Scheme, Context.Request.Host.ToString(), Context.Request.PathBase.ToString()) + }, Context.Request.Scheme, Context.Request.Host.ToString())
  • - Direct Url + Direct Url: @Model.DirectFileUrl