|
@@ -119,8 +119,12 @@ this.singlefile.lib.util = this.singlefile.lib.util || (() => {
|
|
|
return (new DOMParser()).parseFromString(content, "image/svg+xml");
|
|
return (new DOMParser()).parseFromString(content, "image/svg+xml");
|
|
|
},
|
|
},
|
|
|
async digest(algo, text) {
|
|
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) {
|
|
getContentSize(content) {
|
|
|
return new Blob([content]).size;
|
|
return new Blob([content]).size;
|