From 7b2149e5953b11ede108e0279b5e1bc7ad295c2a Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 13 Nov 2023 09:42:31 -0500 Subject: [PATCH] Fix quirks re. diff-updater --- src/_locales/en/messages.json | 4 ++-- src/js/assets.js | 5 ++--- src/js/diff-updater.js | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 72c9cef77..ef1440f0b 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -16,7 +16,7 @@ "description": "A warning in the dashboard when navigating away from unsaved changes" }, "dashboardUnsavedWarningStay": { - "message": "Stay", + "message": "Stay here", "description": "Label for button to prevent navigating away from unsaved changes" }, "dashboardUnsavedWarningIgnore": { @@ -164,7 +164,7 @@ "description": "Tooltip for the no-cosmetic-filtering per-site switch" }, "popupTipNoCosmeticFiltering2": { - "message": "Click to enable cosmetic filtering on this site", + "message": "Click to longer disable cosmetic filtering on this site", "description": "Tooltip for the no-cosmetic-filtering per-site switch" }, "popupTipNoRemoteFonts": { diff --git a/src/js/assets.js b/src/js/assets.js index 0282ce761..9d8c0f9eb 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -1203,6 +1203,7 @@ const getAssetDiffDetails = assetKey => { } out.diffExpires = getUpdateAfterTime(assetKey, true); out.lastModified = cacheEntry.lastModified; + out.writeTime = cacheEntry.writeTime; const assetEntry = assetSourceRegistry[assetKey]; if ( assetEntry === undefined ) { return; } if ( Array.isArray(assetEntry.cdnURLs) === false ) { return; } @@ -1300,9 +1301,7 @@ async function diffUpdater() { } else if ( data.status === 'nopatch-yet' || data.status === 'nodiff' ) { ubolog(`Diff updater: skip update of ${data.name} using ${data.patchPath}\n\treason: ${data.status}`); const assetKey = assetKeyFromDiffName(data.name); - assetCacheSetDetails(assetKey, { - writeTime: data.lastModified || 0 - }); + assetCacheSetDetails(assetKey, { writeTime: data.writeTime }); vAPI.messaging.broadcast({ what: 'assetUpdated', key: assetKey, diff --git a/src/js/diff-updater.js b/src/js/diff-updater.js index 503c35236..55b9686f9 100644 --- a/src/js/diff-updater.js +++ b/src/js/diff-updater.js @@ -117,7 +117,9 @@ function applyPatch(text, diff) { let iAdjust = 0; let iDiff = 0, nDiff = diffLines.length; while ( iDiff < nDiff ) { - const diffParsed = /^([ad])(\d+) (\d+)$/.exec(diffLines[iDiff++]); + const diffLine = diffLines[iDiff++]; + if ( diffLine === '' ) { break; } + const diffParsed = /^([ad])(\d+) (\d+)$/.exec(diffLine); if ( diffParsed === null ) { return; } const op = diffParsed[1]; const iOp = parseInt(diffParsed[2], 10);