manyfold3d / manyfold

A self-hosted digital asset manager for 3d print files.
https://manyfold.app
MIT License
785 stars 50 forks source link

Merging causes files to be deleted #2496

Closed ChronoStriker1 closed 3 weeks ago

ChronoStriker1 commented 2 months ago

Describe the bug When merging a model into another the files be merged will be deleted.

To Reproduce Steps to reproduce the behavior:

  1. Have nested folders
  2. Import a new model or scan for a model you manually placed in the file system
  3. Click on "New model"
  4. Click on Merge button on a model
  5. It will look like it merged in the interface but you will now have a file missing warning, files will be missing from the file system.

Expected behavior The new model will merge into the existing suggested model.

Screenshots I would but I would loose more files...

Desktop (please complete the following information):

Floppy commented 2 months ago

That's worrying... I'll look into it!

Floppy commented 1 month ago

I've tried but not been able to replicate this... would you be able to try it again with the latest version (after you've take copies of the files at risk!)?

Floppy commented 1 month ago

Try as I might, I've not been able to replicate this on either dev or production systems, so I'm going to close it; if you can provide any more detail on how it happened, such as the particular folder structure you mean by "have nested folders", feel free to reopen it, but for now I don't really have any way forward 🫤

Floppy commented 3 weeks ago

I've seen this happen finally - it happens when there are new files in a subfolder of another model after merging.

Floppy commented 3 weeks ago

In this situation:

1) A new model gets created for the subfolder, as it has new files in it! 2) That new model adds all the files in the folder, some of which may be present in a parent model. 3) When it's merged, the duplicated files get moved over the top of themselves, which ends up with them being deleted somehow.

We could resolve this by either checking for existing models with the same path in the parent model before creating them, or by automatically including files in subfolders into the parent model on rescan (assuming the subfolder doesn't have a model already).