mirror of
https://github.com/bitwarden/server
synced 2025-12-18 01:03:17 +00:00
fixes to razor mail service
This commit is contained in:
@@ -222,7 +222,7 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
public override Task<RazorLightProjectItem> GetItemAsync(string templateKey)
|
public override Task<RazorLightProjectItem> GetItemAsync(string templateKey)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(templateKey))
|
if(string.IsNullOrWhiteSpace(templateKey))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(templateKey));
|
throw new ArgumentNullException(nameof(templateKey));
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
public CustomEmbeddedRazorProjectItem(string key)
|
public CustomEmbeddedRazorProjectItem(string key)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(key))
|
if(string.IsNullOrWhiteSpace(key))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(key));
|
throw new ArgumentNullException(nameof(key));
|
||||||
}
|
}
|
||||||
@@ -255,20 +255,8 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override string Key { get; set; }
|
public override string Key { get; set; }
|
||||||
public override bool Exists => true;
|
public override bool Exists => _assembly.GetManifestResourceNames().Any(f => f == _fullTemplateKey);
|
||||||
|
public override Stream Read() => _assembly.GetManifestResourceStream(_fullTemplateKey);
|
||||||
public override Stream Read()
|
|
||||||
{
|
|
||||||
using(var stream = _assembly.GetManifestResourceStream(_fullTemplateKey))
|
|
||||||
{
|
|
||||||
if(stream == null)
|
|
||||||
{
|
|
||||||
throw new RazorLightException($"Couldn't load resource '{_fullTemplateKey}'.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user