Skip to content

Commit

Permalink
Don't expose file last modifed date/time via cachebusted URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-yagodin committed Jan 29, 2020
1 parent d668508 commit 6b54471
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 3 additions & 6 deletions DNN Platform/Library/Entities/Portals/PortalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -634,12 +634,9 @@ public string AddCompatibleHttpHeader
}
}

/*
* add a cachebuster parameter to generated file URI's
*
* of the form ver=[file timestame] ie ver=2015-02-17-162255-735
*
*/
/// <summary>
/// If true then add a cachebuster parameter to generated file URI's.
/// </summary>
public bool AddCachebusterToResourceUris
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ public override string GetFileUrl(IFileInfo file)
// Does site management want the cachebuster parameter?
if (portalSettings.AddCachebusterToResourceUris)
{
return TestableGlobals.Instance.ResolveUrl(fullPath + "?ver=" + file.LastModificationTime.ToString("yyyy-MM-dd-HHmmss-fff"));
var cachebusterToken = UrlUtils.EncryptParameter(file.LastModificationTime.GetHashCode().ToString());

return TestableGlobals.Instance.ResolveUrl(fullPath + "?ver=" + cachebusterToken);
}

return TestableGlobals.Instance.ResolveUrl(fullPath);
Expand Down

0 comments on commit 6b54471

Please sign in to comment.