1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-23 12:25:16 +01:00

fixes to razor mail service

This commit is contained in:
Kyle Spearrin 2017-10-06 15:07:30 -04:00
parent 598034ba19
commit 78f18cac17

View File

@ -222,7 +222,7 @@ namespace Bit.Core.Services
{
public override Task<RazorLightProjectItem> GetItemAsync(string templateKey)
{
if(string.IsNullOrEmpty(templateKey))
if(string.IsNullOrWhiteSpace(templateKey))
{
throw new ArgumentNullException(nameof(templateKey));
}
@ -244,7 +244,7 @@ namespace Bit.Core.Services
public CustomEmbeddedRazorProjectItem(string key)
{
if(string.IsNullOrEmpty(key))
if(string.IsNullOrWhiteSpace(key))
{
throw new ArgumentNullException(nameof(key));
}
@ -255,20 +255,8 @@ namespace Bit.Core.Services
}
public override string Key { get; set; }
public override bool Exists => true;
public override Stream Read()
{
using(var stream = _assembly.GetManifestResourceStream(_fullTemplateKey))
{
if(stream == null)
{
throw new RazorLightException($"Couldn't load resource '{_fullTemplateKey}'.");
}
return stream;
}
}
public override bool Exists => _assembly.GetManifestResourceNames().Any(f => f == _fullTemplateKey);
public override Stream Read() => _assembly.GetManifestResourceStream(_fullTemplateKey);
}
}
}