Skip to content

Commit

Permalink
Throw a human readable exception if theme resource not found by passe…
Browse files Browse the repository at this point in the history
…d path in GetAssetHash method.
  • Loading branch information
tatarincev committed Feb 5, 2019
1 parent 19be8e2 commit ac4ebc8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions VirtoCommerce.LiquidThemeEngine/ShopifyLiquidThemeEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ public string GetAssetHash(string filePath)

using (var stream = GetAssetStream(filePath))
{
if (stream == null)
{
throw new StorefrontException($"Theme resource for path '{filePath}' not found");
}
var hashAlgorithm = CryptoConfig.AllowOnlyFipsAlgorithms ? (SHA256)new SHA256CryptoServiceProvider() : new SHA256Managed();
return WebEncoders.Base64UrlEncode(hashAlgorithm.ComputeHash(stream));
}
Expand Down

0 comments on commit ac4ebc8

Please sign in to comment.