strip path and extension when loading doodle from file

This commit is contained in:
Rick Companje 2021-06-06 20:55:49 +02:00
parent 71ea685880
commit 86ac70678b
1 changed files with 5 additions and 1 deletions

View File

@ -120,8 +120,12 @@ export const openFileSelector = () => {
const imgBlob = await generateThumb(sketcherState, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, 'blob');
const sketchBlob = new Blob([sketchData], { type: 'application/json' });
let name = /[^/]*$/.exec(fileName)[0]; //remove path
if (name) name = name.replace(".doodle3d",""); //remove extension
if (!name) name = fileName; //fallback to fileName if needed
const doc = {
name: fileName.replace(".doodle3d",""),
name: name,
appVersion: VERSION,
_attachments: {
img: { content_type: imgBlob.type, data: imgBlob },