fix(hooks): add robust MIME type handling and Wikipedia download checks
This commit is contained in:
1 file changed
+8
-1
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user