[go: nahoru, domu]

Skip to content

Commit

Permalink
allow protectFileExtensions to go undefined, tested in web project
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Drake committed Oct 6, 2022
1 parent b91f086 commit cdd6c8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Smidge.Core/CompositeFiles/DefaultUrlManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,16 @@ public ParsedUrlPath ParsePath(string input)
}

//can start with 'v' or 'd' (d == debug)
var prefix = parts[parts.Length - 1][0];
var prefix = _config.ProtectFileExtensions ? parts[parts.Length - 2][0] : parts[parts.Length - 1][0];
if (prefix != 'v' && prefix != 'd')
{
//invalid
return null;
}
result.Debug = prefix == 'd';

result.CacheBusterValue = parts[parts.Length - 1].Substring(1);
var ext = parts[parts.Length - 2];
result.CacheBusterValue = _config.ProtectFileExtensions ? parts[parts.Length - 2].Substring(1) : parts[parts.Length - 1].Substring(1);
var ext = _config.ProtectFileExtensions ? parts[parts.Length - 1] : parts[parts.Length - 2];
if (!Enum.TryParse(ext, true, out WebFileType type))
{
//invalid
Expand Down
6 changes: 3 additions & 3 deletions src/Smidge.Core/SmidgeConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;
using System.IO;

namespace Smidge
Expand Down Expand Up @@ -35,7 +35,7 @@ public SmidgeConfig()

public string DataFolder => (_config["dataFolder"] ?? "Smidge").Replace('/', Path.DirectorySeparatorChar);

public bool ProtectFileExtensions => bool.Parse(_config["protectFileExtensions"]);
public bool ProtectFileExtensions => bool.Parse((_config["protectFileExtensions"] ?? "false"));

}
}
}

0 comments on commit cdd6c8f

Please sign in to comment.