This commit is contained in:
Maciej Caderek
2022-02-17 03:36:40 +01:00
parent 3095c3b55e
commit 10cea708f0
25 changed files with 326 additions and 115 deletions

View File

@@ -6,6 +6,7 @@ const download = (data: string | Blob, name: string, ext: string) => {
link.download = `${name}_${Date.now()}.${ext}`;
link.target = "_blank";
link.click();
URL.revokeObjectURL(url);
};
export default download;

14
src/utils/isSafeLink.ts Normal file
View File

@@ -0,0 +1,14 @@
const isSafeLink = (text: string | null) => {
if (text === null) {
return false;
}
try {
const url = new URL(text);
return url.protocol === "https:";
} catch {
return false;
}
};
export default isSafeLink;