Update ApIController.Functions.Files.cs

Only replace the first occurrence of "ws" in the Uri string
This commit is contained in:
thattuys
2022-08-02 19:36:28 -04:00
committed by GitHub
parent 04afc4db02
commit f718ebef9b

View File

@@ -5,6 +5,7 @@ using System.Linq;
using System.Net;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using LZ4;
@@ -55,7 +56,7 @@ namespace MareSynchronos.WebAPI
wc.DownloadProgressChanged += progChanged;
string fileName = Path.GetTempFileName();
var baseUri = new Uri(ApiUri.Replace("ws", "http"), UriKind.Absolute);
var baseUri = new Uri(Regex.Replace(ApiUri, "^ws", "http"), UriKind.Absolute);
var relativeUri = new Uri("cache/" + hash, UriKind.Relative);
var fileUri = new Uri(baseUri, relativeUri);