Add doctype/lang and harden JSON response parsing
This commit is contained in:
+8
-3
@@ -1,4 +1,5 @@
|
||||
<html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -247,8 +248,12 @@
|
||||
|
||||
xhr.addEventListener('load', () => {
|
||||
if (xhr.status === 200) {
|
||||
const response = JSON.parse(xhr.responseText);
|
||||
displayResults(response.urls);
|
||||
try {
|
||||
const response = JSON.parse(xhr.responseText);
|
||||
displayResults(response.urls);
|
||||
} catch (e) {
|
||||
showMessage('Upload failed: Unexpected response from server');
|
||||
}
|
||||
} else {
|
||||
let message = xhr.statusText;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user