From 7313663416c100604bb5b14b9c756862df7557c7 Mon Sep 17 00:00:00 2001 From: Matthew Cantelon Date: Thu, 23 Jul 2015 11:25:18 -0700 Subject: [PATCH] Moved decoding to FindFullPath as encoded values should never be in path --- WebGitNet.SharedLib/FileManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WebGitNet.SharedLib/FileManager.cs b/WebGitNet.SharedLib/FileManager.cs index 611015b..6fb1903 100644 --- a/WebGitNet.SharedLib/FileManager.cs +++ b/WebGitNet.SharedLib/FileManager.cs @@ -32,8 +32,7 @@ public DirectoryInfo DirectoryInfo public ResourceInfo GetResourceInfo(string resourcePath) { - string decodedPath = HttpUtility.UrlDecode(resourcePath); - var fullPath = this.FindFullPath(decodedPath); + var fullPath = this.FindFullPath(resourcePath); var info = new ResourceInfo { FullPath = fullPath }; if (!fullPath.StartsWith(this.rootPath)) @@ -69,7 +68,8 @@ public ResourceInfo GetResourceInfo(string resourcePath) private string FindFullPath(string url) { - var path = Path.Combine(this.rootPath, url); + string decodedUrl = HttpUtility.UrlDecode(url); + var path = Path.Combine(this.rootPath, decodedUrl); return Path.GetFullPath(path); } }