fix(hooks): add robust MIME type handling and Wikipedia download checks

This commit is contained in:
mmacierzanka committed 2026-03-31 21:19:59 +02:00
1 parent 2ab3ada62f
commit 8da179c1dc
1 file changed
+8 -1
+8 -1
View File
@@ -83,9 +83,16 @@ onRecordAfterCreateRequest((e) => {
console.log("Ostatecznie pobieram wybraną okladke z sieci...");
const imgRes = $http.send({
url: thumbUrl,
method: "GET"
method: "GET",
headers: {
"Accept": "image/jpeg, image/png, image/webp, image/gif, image/*;q=0.8"
}
});
if (imgRes.statusCode !== 200) {
throw new Error(`Pobieranie obrazka nie powiodło się, kod statusu: ${imgRes.statusCode}`);
}
const safeTitle = title.replace(/[^a-z0-9]/gi, '_').toLowerCase();
let ext = ".jpg";
const lowerThumbUrl = thumbUrl.toLowerCase();