diff --git a/Oqtane.Server/Pages/Files.cshtml.cs b/Oqtane.Server/Pages/Files.cshtml.cs
index a2bb860b..e2e3c140 100644
--- a/Oqtane.Server/Pages/Files.cshtml.cs
+++ b/Oqtane.Server/Pages/Files.cshtml.cs
@@ -131,8 +131,7 @@ namespace Oqtane.Pages
string downloadName = file.Name;
string filepath = _files.GetFilePath(file);
- var etagValue = file.ModifiedOn.Ticks ^ file.Size;
-
+ // evaluate any querystring parameters
bool isRequestingImageManipulation = false;
int width = 0;
@@ -140,39 +139,34 @@ namespace Oqtane.Pages
if (Request.Query.TryGetValue("width", out var widthStr) && int.TryParse(widthStr, out width) && width > 0)
{
isRequestingImageManipulation = true;
- etagValue ^= (width * 31);
}
if (Request.Query.TryGetValue("height", out var heightStr) && int.TryParse(heightStr, out height) && height > 0)
{
isRequestingImageManipulation = true;
- etagValue ^= (height * 17);
}
Request.Query.TryGetValue("mode", out var mode);
Request.Query.TryGetValue("position", out var position);
Request.Query.TryGetValue("background", out var background);
- if (width > 0 || height > 0)
- {
- if (!string.IsNullOrWhiteSpace(mode)) etagValue ^= mode.ToString().GetHashCode();
- if (!string.IsNullOrWhiteSpace(position)) etagValue ^= position.ToString().GetHashCode();
- if (!string.IsNullOrWhiteSpace(background)) etagValue ^= background.ToString().GetHashCode();
- }
-
int rotate;
if (Request.Query.TryGetValue("rotate", out var rotateStr) && int.TryParse(rotateStr, out rotate) && 360 > rotate && rotate > 0)
{
isRequestingImageManipulation = true;
- etagValue ^= (rotate * 13);
}
-
if (Request.Query.TryGetValue("format", out var format) && _imageService.GetAvailableFormats().Contains(format.ToString()))
{
isRequestingImageManipulation = true;
- etagValue ^= format.ToString().GetHashCode();
}
- etag = Convert.ToString(etagValue, 16);
+ if (isRequestingImageManipulation)
+ {
+ etag = Utilities.GenerateSimpleHash(Request.QueryString.Value);
+ }
+ else
+ {
+ etag = Convert.ToString(file.ModifiedOn.Ticks ^ file.Size, 16);
+ }
var header = "";
if (HttpContext.Request.Headers.TryGetValue(HeaderNames.IfNoneMatch, out var ifNoneMatch))
diff --git a/Oqtane.Shared/Interfaces/IImageService.cs b/Oqtane.Shared/Interfaces/IImageService.cs
index f872b72d..fdd79a56 100644
--- a/Oqtane.Shared/Interfaces/IImageService.cs
+++ b/Oqtane.Shared/Interfaces/IImageService.cs
@@ -1,9 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
namespace Oqtane.Services
{
public interface IImageService