manyfold icon indicating copy to clipboard operation
manyfold copied to clipboard

Purge deletes non-empty folder

Open squk opened this issue 1 year ago • 6 comments

Describe the bug Purge deletes non-empty folder

To Reproduce Steps to reproduce the behavior:

  1. Create a folder
  2. Add a STL to the folder
  3. Scan
  4. Remove STL from the folder
  5. Scan
  6. Purging folder from "problems" deletes the folder and all of it's subdirectories, which may contain other models!

Expected behavior Purge the database entry for the folder, not its contents.

squk avatar Jul 17 '24 14:07 squk

Oof, it shouldn't be doing that if there are other models in there! Thanks for flagging it up, I'll check.

Floppy avatar Jul 17 '24 15:07 Floppy

I suspect that the purge button shouldn't be displayed if there are contained models; we check the delete button on the model itself and remove if it's not safe; it might be that the model purge isn't doing the same check. We should make that safer.

Floppy avatar Jul 17 '24 16:07 Floppy

Wait, I misunderstood. Purging a missing file removes the whole folder and subdirectories??

Floppy avatar Jul 19 '24 08:07 Floppy

I'm afraid I can't replicate this locally; can you provide any more details? Like, the exact contents of the model before purging, a screenshot of the button, etc?

Floppy avatar Jul 19 '24 09:07 Floppy

Here's a better description of the issue: Given the following directory structure:

Armor
├── Shoes.stl
├── Shoulders
│   ├── 1.stl
│   ├── 2.stl
│   ├── 3.stl
├── Chest
│   ├── 1.stl
│   ├── 2.stl
│   ├── 3.stl

Delete or move Shoes.stl:

Armor
├── Shoulders
│   ├── 1.stl
│   ├── 2.stl
│   ├── 3.stl
├── Chest
│   ├── 1.stl
│   ├── 2.stl
│   ├── 3.stl
├── Feet
│   ├── Shoes.stl

The "Armor" model that contained Shoes.stl now appears as empty in issues and is given the option to "Purge". If you do purge, Shoulders, Chest, and Feet are deleted from disk(not ManyFold) and there's no other way to remove the Armor model.

squk avatar Jul 28 '24 21:07 squk

Ah fantastic, I'll give that a try in order to reproduce it.

Floppy avatar Jul 28 '24 21:07 Floppy

I've got this replicated now, should be fixed soon.

Floppy avatar Sep 19 '24 13:09 Floppy