Only compute hash when file has query string

This commit is contained in:
David Montesinos
2025-04-21 16:46:55 +02:00
parent e7acd14faa
commit 430f83e8e9

View File

@ -137,14 +137,14 @@ namespace Oqtane.Pages
string downloadName = file.Name;
string filepath = _files.GetFilePath(file);
var etagInput = $"{file.ModifiedOn.Ticks}:{file.Size}";
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 = "";
if (HttpContext.Request.Headers.TryGetValue(HeaderNames.IfNoneMatch, out var ifNoneMatch))