From e245a4277b5fdeca68ffb6f9aecf52ee812f4ccb Mon Sep 17 00:00:00 2001 From: kipusoep Date: Fri, 1 May 2015 12:48:04 +0200 Subject: [PATCH] Fixed #70 --- Properties/AssemblyInfo.cs | 2 +- .../EmbeddedResourcesVirtualPathProvider.cs | 90 ++++++++++--------- README.md | 2 + UI/UrlTrackerInfo.aspx | 6 ++ 4 files changed, 55 insertions(+), 45 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index e494f08..94a2608 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -30,7 +30,7 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.6.*")] +[assembly: AssemblyVersion("3.7.*")] // SQL [assembly: WebResource("InfoCaster.Umbraco.UrlTracker.SQL.MicrosoftSqlServer.create-table-1.sql", "text/plain")] diff --git a/Providers/EmbeddedResourcesVirtualPathProvider.cs b/Providers/EmbeddedResourcesVirtualPathProvider.cs index 30146c3..658ae70 100644 --- a/Providers/EmbeddedResourcesVirtualPathProvider.cs +++ b/Providers/EmbeddedResourcesVirtualPathProvider.cs @@ -10,55 +10,57 @@ namespace InfoCaster.Umbraco.UrlTracker.Providers { - public class EmbeddedResourcesVirtualPathProvider : VirtualPathProvider - { - public EmbeddedResourcesVirtualPathProvider() - { - } + public class EmbeddedResourcesVirtualPathProvider : VirtualPathProvider + { + public EmbeddedResourcesVirtualPathProvider() + { + } - private bool IsEmbeddedResourcePath(string virtualPath) - { - var checkPath = VirtualPathUtility.ToAppRelative(virtualPath); - return checkPath.StartsWith("~/Umbraco/UrlTracker/", StringComparison.InvariantCultureIgnoreCase); - } + private bool IsEmbeddedResourcePath(string virtualPath) + { + var checkPath = VirtualPathUtility.ToAppRelative(virtualPath); + return checkPath.StartsWith("~/Umbraco/UrlTracker/", StringComparison.InvariantCultureIgnoreCase); + } - public override bool FileExists(string virtualPath) - { - return IsEmbeddedResourcePath(virtualPath) || base.FileExists(virtualPath); - } + public override bool FileExists(string virtualPath) + { + return IsEmbeddedResourcePath(virtualPath) || base.FileExists(virtualPath); + } - public override VirtualFile GetFile(string virtualPath) - { - if (IsEmbeddedResourcePath(virtualPath)) - return new EmbeddedResourceVirtualFile(virtualPath); - return base.GetFile(virtualPath); - } + public override VirtualFile GetFile(string virtualPath) + { + if (IsEmbeddedResourcePath(virtualPath)) + return new EmbeddedResourceVirtualFile(virtualPath); + return base.GetFile(virtualPath); + } - public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart) - { - if (IsEmbeddedResourcePath(virtualPath)) - return null; - return base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart); - } - } + public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart) + { + if (IsEmbeddedResourcePath(virtualPath)) + return null; + return base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart); + } + } - public class EmbeddedResourceVirtualFile : VirtualFile - { - string _path; + public class EmbeddedResourceVirtualFile : VirtualFile + { + readonly string _path; - public EmbeddedResourceVirtualFile(string virtualPath) - : base(virtualPath) - { - _path = VirtualPathUtility.ToAppRelative(virtualPath); - } + public EmbeddedResourceVirtualFile(string virtualPath) + : base(virtualPath) + { + _path = VirtualPathUtility.ToAppRelative(virtualPath); + } - public override Stream Open() - { - var resourceName = _path.Split('/').Last(); - var assembly = GetType().Assembly; - if (assembly != null) - return assembly.GetManifestResourceStream(resourceName); - return null; - } - } + public override Stream Open() + { + var resourceName = _path.Split('/').Last(); + var assembly = GetType().Assembly; + resourceName = assembly.GetManifestResourceNames() + .SingleOrDefault(x => x.Equals(resourceName, StringComparison.OrdinalIgnoreCase)); + if (string.IsNullOrEmpty(resourceName)) + return null; + return assembly.GetManifestResourceStream(resourceName); + } + } } \ No newline at end of file diff --git a/README.md b/README.md index 1665fca..52311a6 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ Set to true to disable tracking not found (404) requests. Set to false to disable appending a port number to redirect URLs ## Changelog ## +* 3.7 [2015/05/01] + * [BugFix] Exception on install ([#70](https://github.com/kipusoep/UrlTracker/issues/70)) * 3.6 [2015/03/21] * [BugFix] Rootnode resolving bug fixed ([#69](https://github.com/kipusoep/UrlTracker/issues/69)) * 3.5 [2015/02/20] diff --git a/UI/UrlTrackerInfo.aspx b/UI/UrlTrackerInfo.aspx index c7aa807..73c74e0 100644 --- a/UI/UrlTrackerInfo.aspx +++ b/UI/UrlTrackerInfo.aspx @@ -86,6 +86,12 @@