Skip to content

Commit 3687d9c

Browse files
committed
Fix issue with useDefaultRoute parsing to bool
1 parent 3dfdfe1 commit 3687d9c

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/UmbracoFileSystemProviders.Azure.Tests/AzureBlobFileSystemTestsBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ public AzureBlobFileSystem CreateAzureBlobFileSystem(bool disableVirtualPathProv
4141
string rootUrl = "http://127.0.0.1:10000/devstoreaccount1/";
4242
string connectionString = "UseDevelopmentStorage=true";
4343
string maxDays = "30";
44+
string useDefaultRoute = "true";
4445

4546
Mock<ILogHelper> logHelper = new Mock<ILogHelper>();
4647
Mock<IMimeTypeResolver> mimeTypeHelper = new Mock<IMimeTypeResolver>();
4748

48-
return new AzureBlobFileSystem(containerName, rootUrl, connectionString, maxDays, true)
49+
return new AzureBlobFileSystem(containerName, rootUrl, connectionString, maxDays, useDefaultRoute)
4950
{
5051
FileSystem =
5152
{

src/UmbracoFileSystemProviders.Azure/AzureBlobFileSystem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class AzureBlobFileSystem : IFileSystem
2525
/// <param name="rootUrl">The root url.</param>
2626
/// <param name="connectionString">The connection string.</param>
2727
public AzureBlobFileSystem(string containerName, string rootUrl, string connectionString)
28-
: this(containerName, rootUrl, connectionString, "365", true)
28+
: this(containerName, rootUrl, connectionString, "365", "true")
2929
{
3030
}
3131

@@ -37,7 +37,7 @@ public AzureBlobFileSystem(string containerName, string rootUrl, string connecti
3737
/// <param name="connectionString">The connection string.</param>
3838
/// <param name="maxDays">The maximum number of days to cache blob items for in the browser.</param>
3939
/// <param name="useDefaultRoute">Whether to use the default "media" route in the url independent of the blob container.</param>
40-
public AzureBlobFileSystem(string containerName, string rootUrl, string connectionString, string maxDays, bool useDefaultRoute)
40+
public AzureBlobFileSystem(string containerName, string rootUrl, string connectionString, string maxDays, string useDefaultRoute)
4141
{
4242
this.FileSystem = AzureFileSystem.GetInstance(containerName, rootUrl, connectionString, maxDays, useDefaultRoute);
4343
}

src/UmbracoFileSystemProviders.Azure/AzureFileSystem.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private AzureFileSystem(string containerName, string rootUrl, string connectionS
156156
/// <param name="maxDays">The maximum number of days to cache blob items for in the browser.</param>
157157
/// <param name="useDefaultRoute">Whether to use the default "media" route in the url independent of the blob container.</param>
158158
/// <returns>The <see cref="AzureFileSystem"/></returns>
159-
public static AzureFileSystem GetInstance(string containerName, string rootUrl, string connectionString, string maxDays, bool useDefaultRoute)
159+
public static AzureFileSystem GetInstance(string containerName, string rootUrl, string connectionString, string maxDays, string useDefaultRoute)
160160
{
161161
lock (Locker)
162162
{
@@ -168,7 +168,13 @@ public static AzureFileSystem GetInstance(string containerName, string rootUrl,
168168
max = 365;
169169
}
170170

171-
fileSystem = new AzureFileSystem(containerName, rootUrl, connectionString, max, useDefaultRoute);
171+
bool defaultRoute;
172+
if (!bool.TryParse(useDefaultRoute, out defaultRoute))
173+
{
174+
defaultRoute = true;
175+
}
176+
177+
fileSystem = new AzureFileSystem(containerName, rootUrl, connectionString, max, defaultRoute);
172178
}
173179

174180
return fileSystem;

0 commit comments

Comments
 (0)