Skip to content

Commit 110e4a5

Browse files
Fix relative path determination
1 parent e1fa391 commit 110e4a5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/UmbracoFileSystemProviders.Azure/AzureFileSystem.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,16 +572,21 @@ private CloudBlobDirectory GetDirectoryReference(string path)
572572
private string ResolveUrl(string path, bool relative)
573573
{
574574
// First create the full url
575-
Uri url = new Uri(new Uri(this.rootUrl, UriKind.Absolute), this.FixPath(path));
575+
string fixedPath = this.FixPath(path);
576+
577+
Uri url = new Uri(new Uri(this.rootUrl, UriKind.Absolute), fixedPath);
576578

577579
if (!relative)
578580
{
579581
return url.AbsoluteUri;
580582
}
581583

582-
int index = url.AbsolutePath.IndexOf(this.ContainerName, StringComparison.Ordinal) - 1;
583-
string relativePath = url.AbsolutePath.Substring(index);
584-
return relativePath;
584+
if (this.UseDefaultRoute)
585+
{
586+
return string.Format("/{0}/{1}", Constants.DefaultMediaRoute, fixedPath);
587+
}
588+
589+
return string.Format("/{0}/{1}", this.ContainerName, fixedPath);
585590
}
586591

587592
/// <summary>

0 commit comments

Comments
 (0)