Extract list name from hash portion of `! Diff-Path:`

This commit is contained in:
Raymond Hill 2023-11-03 18:39:14 -04:00
parent b7bb26807d
commit aeff955667
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 5 additions and 3 deletions

View File

@ -49,8 +49,7 @@ const basename = url => {
const resolveURL = (path, url) => { const resolveURL = (path, url) => {
try { try {
const urlAfter = new URL(path, url); return new URL(path, url);
return urlAfter.href;
} }
catch(_) { catch(_) {
} }
@ -201,8 +200,11 @@ async function fetchPatchDetailsFromCDNs(assetDetails) {
if ( response.ok !== true ) { continue; } if ( response.ok !== true ) { continue; }
const patchText = await response.text(); const patchText = await response.text();
const patchDetails = parsePatch(patchText); const patchDetails = parsePatch(patchText);
if ( patchURL.hash.length > 1 ) {
assetDetails.diffName = patchURL.hash.slice(1);
}
return { return {
patchURL, patchURL: patchURL.href,
patchSize: `${(patchText.length / 1000).toFixed(1)} KB`, patchSize: `${(patchText.length / 1000).toFixed(1)} KB`,
patchDetails, patchDetails,
}; };