Only compute hash when file has query string
This commit is contained in:
@ -137,14 +137,14 @@ namespace Oqtane.Pages
|
|||||||
string downloadName = file.Name;
|
string downloadName = file.Name;
|
||||||
string filepath = _files.GetFilePath(file);
|
string filepath = _files.GetFilePath(file);
|
||||||
|
|
||||||
var etagInput = $"{file.ModifiedOn.Ticks}:{file.Size}";
|
|
||||||
|
|
||||||
if (Request.QueryString.HasValue)
|
if (Request.QueryString.HasValue)
|
||||||
{
|
{
|
||||||
etagInput += $":{Request.QueryString.Value}";
|
etag = Utilities.GenerateSimpleHash16($"{file.ModifiedOn.Ticks}:{file.Size}:{Request.QueryString.Value}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
etag = Convert.ToString(file.ModifiedOn.Ticks ^ file.Size, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
etag = Utilities.GenerateSimpleHash16(etagInput);
|
|
||||||
|
|
||||||
var header = "";
|
var header = "";
|
||||||
if (HttpContext.Request.Headers.TryGetValue(HeaderNames.IfNoneMatch, out var ifNoneMatch))
|
if (HttpContext.Request.Headers.TryGetValue(HeaderNames.IfNoneMatch, out var ifNoneMatch))
|
||||||
|
Reference in New Issue
Block a user