minista 2.7.4 → 2.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/download.js +8 -2
- package/package.json +1 -1
package/dist/download.js
CHANGED
|
@@ -94,9 +94,15 @@ async function downloadFiles(entryPoints, remoteUrl, remoteName, downloadOutDir,
|
|
|
94
94
|
}));
|
|
95
95
|
await Promise.all(targetPages.map(async (targetPage) => {
|
|
96
96
|
const html = await fs.readFile(targetPage.entryPoint, "utf8");
|
|
97
|
-
const
|
|
97
|
+
const joinedUrl = targetPage.remoteImgUrls.map((url) => {
|
|
98
|
+
return url.replaceAll("&", "&").replaceAll("?", "\\?");
|
|
99
|
+
}).join("|");
|
|
100
|
+
const reg = new RegExp(joinedUrl, "g");
|
|
98
101
|
function replacer(match) {
|
|
99
|
-
const replaceData = imgSrcList.find((item) =>
|
|
102
|
+
const replaceData = imgSrcList.find((item) => {
|
|
103
|
+
const unescapedMatch = match.replaceAll("&", "&");
|
|
104
|
+
return item.remoteImgUrl === unescapedMatch;
|
|
105
|
+
});
|
|
100
106
|
const localImgUrl = (replaceData == null ? void 0 : replaceData.localImgUrl) || match;
|
|
101
107
|
return localImgUrl;
|
|
102
108
|
}
|