Jelajahi Sumber

ignore API errors

Former-commit-id: 6260bfaac1948da24af4220401e82a4dc29c8e75
Gildas 6 tahun lalu
induk
melakukan
fdad0bfdb3
1 mengubah file dengan 6 tambahan dan 2 penghapusan
  1. 6 2
      lib/single-file/single-file-util.js

+ 6 - 2
lib/single-file/single-file-util.js

@@ -119,8 +119,12 @@ this.singlefile.lib.util = this.singlefile.lib.util || (() => {
 					return (new DOMParser()).parseFromString(content, "image/svg+xml");
 				},
 				async digest(algo, text) {
-					const hash = await crypto.subtle.digest(algo, new TextEncoder("utf-8").encode(text));
-					return hex(hash);
+					try {
+						const hash = await crypto.subtle.digest(algo, new TextEncoder("utf-8").encode(text));
+						return hex(hash);
+					} catch (error) {
+						return "";
+					}
 				},
 				getContentSize(content) {
 					return new Blob([content]).size;