From ce52bfea38ffa3022f6170b7407b306b70b98a1d Mon Sep 17 00:00:00 2001 From: Matt Gray Date: Tue, 3 Dec 2024 10:33:33 +0000 Subject: [PATCH] Another fix for previewPlaceholderHtml changes in Craft 5.5.0 --- CHANGELOG.md | 8 ++++++++ composer.json | 2 +- src/AssetsPlatform/AssetsPlatform.php | 8 ++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cbceb3..95723a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes for Servd Assets and Helpers +## 4.0.11 - 2024-12-03 + +### Fixed + +- Another fix for compatibility with previewPlaceholderHtml changes in Craft 5.5.0 + ## 4.0.10 - 2024-11-22 ### Updated @@ -9,6 +15,8 @@ ## 4.0.9 - 2024-11-15 +### Fixed + - Speculative fix for compatibility with previewPlaceholderHtml changes in Craft 5.5.0 ## 4.0.8 - 2024-09-30 diff --git a/composer.json b/composer.json index a142ee5..f1dd143 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "servd/craft-asset-storage", "description": "Servd Asset Storage and Helpers integration for Craft CMS", - "version": "4.0.10", + "version": "4.0.11", "type": "craft-plugin", "keywords": [ "cms", diff --git a/src/AssetsPlatform/AssetsPlatform.php b/src/AssetsPlatform/AssetsPlatform.php index f644598..00ac2f7 100644 --- a/src/AssetsPlatform/AssetsPlatform.php +++ b/src/AssetsPlatform/AssetsPlatform.php @@ -370,11 +370,15 @@ public function getFileUrl(Asset $asset) } // Append dm query parameter to allow cache busting if the underlying asset changes + $dmTimestamp = 0; + if (!empty($asset->dateUpdated)){ + $dmTimestamp = $asset->dateUpdated->getTimestamp(); + } $finalUrlQuery = parse_url($finalUrl, PHP_URL_QUERY); if ($finalUrlQuery) { - $finalUrl .= '&dm=' . $asset->dateUpdated->getTimestamp(); + $finalUrl .= '&dm=' . $dmTimestamp; } else { - $finalUrl .= '?dm=' . $asset->dateUpdated->getTimestamp(); + $finalUrl .= '?dm=' . $dmTimestamp; } return $finalUrl;