Skip to content

Commit bfc2841

Browse files
Fix getting blob path with empty container root path
1 parent 5ac5549 commit bfc2841

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)