mirror of
https://github.com/Doodle3D/Doodle3D-Transform.git
synced 2024-11-22 13:37:57 +01:00
strip path and extension when loading doodle from file
This commit is contained in:
parent
71ea685880
commit
86ac70678b
@ -120,8 +120,12 @@ export const openFileSelector = () => {
|
|||||||
const imgBlob = await generateThumb(sketcherState, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, 'blob');
|
const imgBlob = await generateThumb(sketcherState, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, 'blob');
|
||||||
const sketchBlob = new Blob([sketchData], { type: 'application/json' });
|
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 = {
|
const doc = {
|
||||||
name: fileName.replace(".doodle3d",""),
|
name: name,
|
||||||
appVersion: VERSION,
|
appVersion: VERSION,
|
||||||
_attachments: {
|
_attachments: {
|
||||||
img: { content_type: imgBlob.type, data: imgBlob },
|
img: { content_type: imgBlob.type, data: imgBlob },
|
||||||
|
Loading…
Reference in New Issue
Block a user