WIP
This commit is contained in:
@@ -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
14
src/utils/isSafeLink.ts
Normal 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;
|
||||
Reference in New Issue
Block a user