Skip to content
Snippets Groups Projects
Commit 41ec7cd4 authored by Tomi Valentová's avatar Tomi Valentová
Browse files

fix filename generation

parent 5d33eaa6
No related branches found
No related tags found
No related merge requests found
Pipeline #19153 passed
......@@ -41,10 +41,16 @@ export default {
let link = document.createElement("a");
if (window.fileName !== undefined) {
if (
window.fileName !== undefined && window.fileName !== null
&& (typeof window.fileName === 'string' || window.fileName instanceof String)
&& window.fileName.length >= 1
) {
link.download = window.fileName;
} else {
link.download = `Generator-${new Date().toLocaleString()}.png`;
const date = new Date().toLocaleString();
link.download = `Generator-${date}.png`;
}
link.href = this.$refs.canvas.toDataURL();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment