Skip to content

Commit 09c4964

Browse files
Merge pull request #60 from umbraco/bugfix/empty-containerrootpath
Fix getting blob path with empty container root path
2 parents 57c4ecb + bfc2841 commit 09c4964

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Umbraco.StorageProviders.AzureBlob/IO/AzureBlobFileSystem.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,16 @@ private string GetBlobPath(string path)
361361
{
362362
path = EnsureUrlSeparatorChar(path);
363363

364-
if (_ioHelper.PathStartsWith(path, _containerRootPath, '/'))
364+
if (!string.IsNullOrEmpty(_containerRootPath) &&
365+
_ioHelper.PathStartsWith(path, _containerRootPath, '/'))
365366
{
367+
// Path already starts with the root path
366368
return path;
367369
}
368370

369371
if (_ioHelper.PathStartsWith(path, _rootUrl, '/'))
370372
{
373+
// Remove root URL from path (e.g. /media/abc123/file.ext to /abc123/file.ext)
371374
path = path[_rootUrl.Length..];
372375
}
373376

0 commit comments

Comments
 (0)