From 193672dae58c2e9c0c8055e3f1d5fe8bcda326e8 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 11 Nov 2023 09:35:08 -0500 Subject: [PATCH] Extract diff-name from diff-path when diff-name field is missing --- src/js/assets.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/js/assets.js b/src/js/assets.js index 2c40196ba..5771f2192 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -1193,10 +1193,14 @@ const getAssetDiffDetails = assetKey => { const out = { name: assetKey }; const cacheEntry = assetCacheRegistry[assetKey]; if ( cacheEntry === undefined ) { return; } - if ( cacheEntry.diffPath === undefined ) { return; } - if ( cacheEntry.diffName === undefined ) { return; } - out.diffName = cacheEntry.diffName; out.patchPath = cacheEntry.diffPath; + if ( out.patchPath === undefined ) { return; } + out.diffName = cacheEntry.diffName; + if ( out.diffName === undefined ) { + const match = /#.+$/.exec(out.patchPath); + if ( match === null ) { return; } + out.diffName = match[0].slice(1); + } out.diffExpires = getUpdateAfterTime(assetKey, true); out.lastModified = cacheEntry.lastModified; const assetEntry = assetSourceRegistry[assetKey]; @@ -1217,8 +1221,6 @@ async function diffUpdater() { const assetKey = toUpdate.shift(); const assetDetails = getAssetDiffDetails(assetKey); if ( assetDetails === undefined ) { continue; } - if ( assetDetails.patchPath === undefined ) { continue; } - if ( assetDetails.diffName === undefined ) { continue; } assetDetails.what = 'update'; if ( (getWriteTime(assetKey) + assetDetails.diffExpires) > now ) { assetDetails.fetch = false;