#20742: Query String Incorrectly Used in Cache Key

WorkItem: 20742
This commit is contained in:
Stanley Goldman
2014-10-14 19:59:06 -04:00
parent 60021d92f4
commit 5adf1e7407
2 changed files with 3 additions and 8 deletions

View File

@@ -515,14 +515,7 @@ namespace Orchard.OutputCache.Filters {
}
private string ComputeCacheKey(ControllerContext controllerContext, IEnumerable<KeyValuePair<string, object>> parameters) {
var url = controllerContext.HttpContext.Request.RawUrl;
if (!VirtualPathUtility.IsAbsolute(url)) {
var applicationRoot = new UrlHelper(controllerContext.HttpContext.Request.RequestContext).MakeAbsolute("/");
if (url.StartsWith(applicationRoot, StringComparison.OrdinalIgnoreCase)) {
url = "~/" + url.Substring(applicationRoot.Length);
url = VirtualPathUtility.ToAbsolute(url);
}
}
var url = controllerContext.HttpContext.Request.Url.AbsolutePath;
return ComputeCacheKey(_shellSettings.Name, url, () => _workContext.CurrentCulture, _themeManager.GetRequestTheme(controllerContext.RequestContext).Id, parameters);
}

View File

@@ -15,6 +15,7 @@
<thead>
<tr>
<th scope="col">@T("Url")</th>
<th scope="col">@T("Cache Key")</th>
<th scope="col">@T("Cached On")</th>
<th scope="col">@T("Cached Until")</th>
<th scope="col">&nbsp;</th>
@@ -23,6 +24,7 @@
@foreach (var cacheItem in Model.CacheItems) {
<tr>
<td><span title="@cacheItem.QueryString">@cacheItem.Url</span></td>
<td>@cacheItem.CacheKey</td>
<td>@Display.DateTimeRelative(DateTimeUtc: cacheItem.CachedOnUtc)</td>
<td>@cacheItem.ValidUntilUtc.ToLocalTime()</td>
<td>@Html.ActionLink(T("Evict").Text, "Evict", new { Area = "Orchard.OutputCache", Controller = "Statistics", cacheKey = cacheItem.CacheKey })</td>