Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into issue/OSOE-751
Browse files Browse the repository at this point in the history
# Conflicts:
#	Lombiq.Hosting.MediaTheme.Bridge/Services/FileVersionProviderDecorator.cs
  • Loading branch information
Psichorex committed Jan 27, 2024
2 parents e7fc9a9 + 183f9c4 commit 61cb2b1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public string AddFileVersionToPath(PathString requestPathBase, string path)

var assetsSubPath = mediaFileStore.Combine(
mediaOptions.Value.AssetsRequestPath, Paths.MediaThemeRootFolder, Paths.MediaThemeAssetsFolder);
path = path.Replace(Routes.MediaThemeAssets, assetsSubPath);

// Note that this will work all the time for local files. When a remote storage implementation is used to store
// Media files though (like Azure Blob Storage) then Media Cache will mirror the files locally. Since this only
Expand All @@ -50,14 +49,14 @@ public string AddFileVersionToPath(PathString requestPathBase, string path)
// then the original file will get stuck, and no cache busting parameter will be added until the new file is
// accessed with some other cache busting parameter. So, before the actual cache busting parameter can be added,
// we need to add a random parameter.
var cacheBustedPath = decorated.AddFileVersionToPath(requestPathBase, path);
var cacheBustedPath = _decorated.AddFileVersionToPath(requestPathBase, path.Replace(Routes.MediaThemeAssets, assetsSubPath));

// This check could be more sophisticated with UriBuilder, but let's keep it simple, since it'll run frequently.
if (!cacheBustedPath.Contains("?v="))
{
return QueryHelpers.AddQueryString(path, "mediatheme", _randomizer.Get().ToTechnicalString());
}

return cacheBustedPath;
return cacheBustedPath.Replace(assetsSubPath, Routes.MediaThemeAssets);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"SourcePath": "_MediaTheme/Assets/example.png",
"TargetPath": "_MediaTheme/Assets/example.png"
},
{
"SourcePath": "_MediaTheme/Assets/example2.png",
"TargetPath": "_MediaTheme/Assets/example2.png"
},
{
"SourcePath": "_MediaTheme/Templates/Example.liquid",
"TargetPath": "_MediaTheme/Templates/Example.liquid"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<p>This is an example template hosted in Media Theme.</p>
<p>Below is an image also hosted in Media Theme:</p>
{% comment %}
The images are from https://unsplash.com/.
{% endcomment %}
<img src="{{ '~/mediatheme/example.png' | href }}" alt="example" />

<img src="{{ '~/mediatheme/example2.png' | href | append_version }}" alt="example2" />

0 comments on commit 61cb2b1

Please sign in to comment.