Skip to content

Commit b6ac119

Browse files
tapayne88acao
authored andcommitted
Swapped out all instances of http with https to fix "No entry in local cache..." errors
1 parent 2556817 commit b6ac119

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scripts/download.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ const resources = [
2020
'films',
2121
];
2222

23+
function replaceHttp(url) {
24+
return url.replace(/http:\/\//g, 'https://');
25+
}
26+
2327
function normalizeUrl(url) {
24-
return new URL(url).toString();
28+
return replaceHttp(new URL(url).toString());
2529
}
2630

2731
/**
@@ -38,7 +42,9 @@ async function cacheResources() {
3842
while (url != null) {
3943
console.error(url);
4044
const response = await fetch(url, { agent });
41-
const data = await response.json();
45+
const text = await response.text();
46+
47+
const data = JSON.parse(replaceHttp(text));
4248

4349
cache[normalizeUrl(url)] = data;
4450
for (const obj of data.results || []) {

0 commit comments

Comments
 (0)