diff --git a/src/ServicePulse.Host/Nancy/SpecialEmbeddedFileResponse.cs b/src/ServicePulse.Host/Nancy/SpecialEmbeddedFileResponse.cs index 25ddd74340..c5e33373ef 100644 --- a/src/ServicePulse.Host/Nancy/SpecialEmbeddedFileResponse.cs +++ b/src/ServicePulse.Host/Nancy/SpecialEmbeddedFileResponse.cs @@ -2,6 +2,7 @@ { using System; using System.IO; + using System.Linq; using System.Reflection; using System.Security.Cryptography; using System.Text; @@ -14,7 +15,7 @@ public SpecialEmbeddedFileResponse(Assembly assembly, string resourcePath) ContentType = MimeTypes.GetMimeType(Path.GetFileName(resourcePath)); StatusCode = HttpStatusCode.OK; - var content = assembly.GetManifestResourceStream(resourcePath); + var content = LoadContentFromManifest(assembly, resourcePath); if (content == null) { @@ -26,6 +27,22 @@ public SpecialEmbeddedFileResponse(Assembly assembly, string resourcePath) Contents = GetFileContent(content); } + private Stream LoadContentFromManifest(Assembly assembly, string resourcePath) + { + var resource = assembly.GetManifestResourceStream(resourcePath); + + if (resource != null) + { + return resource; + } + + var matchingKey = + assembly.GetManifestResourceNames() + .FirstOrDefault(name => string.Compare(resourcePath, name, StringComparison.OrdinalIgnoreCase) == 0); + + return assembly.GetManifestResourceStream(matchingKey); + } + private static Action GetFileContent(Stream content) { return stream =>