mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-26 20:16:15 +08:00
GetPhysicalPath returns error if url contains '?' (#8526)
* GetPhysicalPath returns error if url contains '?' Fixes * Update ResourceDefinition.cs Co-authored-by: Sébastien Ros <sebastienros@gmail.com> Co-authored-by: matteo.piovanelli <matteo.piovanelli@laser-group.com>
This commit is contained in:
@@ -8,6 +8,8 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.UI.Resources {
|
||||
public class ResourceDefinition {
|
||||
private static readonly char[] _queryStringChars = new [] { '?' };
|
||||
|
||||
private static readonly Dictionary<string, string> _resourceTypeTagNames = new Dictionary<string, string> {
|
||||
{ "script", "script" },
|
||||
{ "stylesheet", "link" }
|
||||
@@ -284,10 +286,10 @@ namespace Orchard.UI.Resources {
|
||||
private string GetPhysicalPath(string url) {
|
||||
if (!String.IsNullOrEmpty(url) && !Uri.IsWellFormedUriString(url, UriKind.Absolute) && !url.StartsWith("//")) {
|
||||
if (VirtualPathUtility.IsAbsolute(url) || VirtualPathUtility.IsAppRelative(url)) {
|
||||
return HostingEnvironment.MapPath(url.Split(new[] { '?' })[0]);
|
||||
return HostingEnvironment.MapPath(url.Split(_queryStringChars)[0]);
|
||||
}
|
||||
if (!String.IsNullOrEmpty(BasePath)) {
|
||||
return HostingEnvironment.MapPath(VirtualPathUtility.Combine(BasePath, url));
|
||||
return HostingEnvironment.MapPath(VirtualPathUtility.Combine(BasePath, url.Split(_queryStringChars)[0]));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user