forked from OrchardCMS/OrchardCore
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ImageSharp.Web v2 (OrchardCMS#11585)
- Loading branch information
1 parent
309bae2
commit de48dc2
Showing
12 changed files
with
74 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/OrchardCore.Modules/OrchardCore.Media/Processing/BackwardsCompatibleCacheKey.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using SixLabors.ImageSharp.Web; | ||
using SixLabors.ImageSharp.Web.Caching; | ||
using SixLabors.ImageSharp.Web.Commands; | ||
|
||
namespace OrchardCore.Media.Processing | ||
{ | ||
/// <summary> | ||
/// Backwards compatible absolute url cache key. | ||
/// </summary> | ||
public class BackwardsCompatibleCacheKey : ICacheKey | ||
{ | ||
/// <inheritdoc/> | ||
public string Create(HttpContext context, CommandCollection commands) | ||
{ | ||
|
||
var pathBase = context.Request.PathBase; | ||
if (pathBase.HasValue) | ||
{ | ||
// Due to bugs with an earlier version of cache calculation the cache key result was | ||
// localhost:44300/agency1//media/portfolio/5.jpg?width=600&height=480&rmode=stretch | ||
// the default ImageSharp absolute cache builder produces the correct value | ||
// localhost:44300/agency1/media/portfolio/5.jpg?width=600&height=480&rmode=stretch | ||
// which causes an entire cache refresh. | ||
// refer https://github.com/SixLabors/ImageSharp.Web/issues/254 | ||
|
||
pathBase = new PathString(pathBase + "//"); | ||
} | ||
|
||
return CaseHandlingUriBuilder.BuildAbsolute(CaseHandlingUriBuilder.CaseHandling.LowerInvariant, context.Request.Host, pathBase, context.Request.Path, QueryString.Create(commands)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters