1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

Properly handle failed fetches in code viewer

This commit is contained in:
Raymond Hill 2023-03-14 08:58:52 -04:00
parent 0ba5ec162b
commit c0529307fa
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -105,9 +105,9 @@ async function fetchResource(url) {
response = await fetch(url, fetchOptions);
text = await response.text();
} catch(reason) {
text = reason;
text = String(reason);
}
let mime = response.headers.get('Content-Type') || '';
let mime = response && response.headers.get('Content-Type') || '';
mime = mime.replace(/\s*;.*$/, '').trim();
const beautifierOptions = {
'end_with_newline': true,