Suwayomi-Server icon indicating copy to clipboard operation
Suwayomi-Server copied to clipboard

[Bug] [Critical] Selecting existing Directory as Download Folder deletes existing data

Open radry opened this issue 11 months ago • 12 comments

Device information

  • Suwayomi-Server version: v1.0.0-r1498-windows-x64
  • Server Operating System: Win 10
  • Server JVM version: bundled with server
  • Client Operating System: Win 10

Steps to reproduce

  1. Launch Server .bat
  2. Set an existing Directory as Download Folder in Launcher
  3. Start Server with WebUI
  4. Download a Manga (to be sure it writes into the set directory, maybe this caused the deletion of all existing content)

Expected behavior

Existing Data is not deleted

Actual behavior

Everything in the existing Directory is deleted without warning and no way to recover it

Other details

This is a critical bug! Data was lost!

radry avatar Feb 25 '24 14:02 radry

I'm not a dev but I also noticed something funky when I was trying to set custom folders in the "Suwayomi-Server Launcher". If I manually input the name of a new folder in the "path box", every time I type a new character, the launcher will create a new folder with the name of the existing value at that moment.

eg: If I want to change my download folder from "E:\Images\Manga\.Suwayomi" to "E:\Images\Manga\.Suwayomi\abcd", the launcher will create 4 folders like this:

and it leaves the original folder alone. This happens to the "Root Directory" as well.

So I might suggest checking thoroughly if your original folder is not hidden in an alternative path route, and also deleting cache for the suwayomi webclient (ctrl+f5 in your browser while in the suwayomi tab should suffice).

Even then, this is something that should be dealt with, because last time I also had to manually remove like 20 folders because I was messing with directories from that launcher. For next time, I suggest backing up your folders and using the server.conf file instead of the java launcher to set new routes for directories. Copying the exact path into the box also seems to work, if you deviate it brings out these problems it seems.

TyrantRC avatar Feb 25 '24 21:02 TyrantRC

If I manually input the name of a new folder in the "path box", every time I type a new character, the launcher will create a new folder with the name of the existing value at that moment.

You are right. That happened to me too, but it's not critical, just annoying.

The issue however is that the existing content was delete for me. I already had a directory G:\Manga with existing folders and files inside. I set this directory in the Launcher and then all the existing content was gone. I don't know if it happened when it launched or when it downloaded a manga for the first time.

radry avatar Feb 25 '24 22:02 radry

Having the same issue as the original post. Great tool rendered fully unusable by this bug.

mvayala avatar Aug 08 '24 02:08 mvayala

this is not reproducable

pretty sure that was the first time you started the server and in that case the server will just move everything that is not the thumbnails folder into the mangas folder inside of the downloads folder

suwayomi has its own download structure and logic, the only reason one can change the download location is so you can chose some other location where there is more storage space available it's not supposed to have any other data inside this loation besides suwayomi related data

schroda avatar Aug 08 '24 11:08 schroda

@schroda even if it happens only on the first launch it is a critical bug. If it is intentional that it deletes everything in the download folder (which I think is not reasonable) there must be a warning and confirmation dialog. Else nobody knows about this behaviour.

radry avatar Aug 08 '24 14:08 radry

If it is intentional that it deletes everything

as written in the previous comment, nothing gets deleted, it gets moved to another folder

the server will just move everything that is not the thumbnails folder into the mangas folder inside of the downloads folder

the files are moved once because the download structure was changed at some point in time, thus, a migration was required so the downloads were not broken after updating the server

which I think is not reasonable

again, the downloads (and everything else) are only intended for internal usage anything else is unsupported, which includes changing the download location to some folder that already includes data that the server does not expect to exist not only will you run into this "issue" in that case but external data in this folder (or any other suwayomi related folder) might cause unexpected behaviour

schroda avatar Aug 08 '24 15:08 schroda

@schroda moved where exactly (on windows). I can't find it anywhere, it was seemingly deleted.

As described in the initial report, I chose an existing folder as download folder. After launching it became empty.

If you insist on defending bad practices then at least a warning should be issued that choosing an existing folder will cause the files to be deleted (or moved as you claim).

radry avatar Aug 09 '24 14:08 radry

moved where exactly (on windows). I can't find it anywhere, it was seemingly deleted.

as was written in my last 2 comments:

the server will just move everything that is not the thumbnails folder into the mangas folder inside of the downloads folder

  • downloads folder = your chosen download location
  • mangas folder = sub folder in downloads folder
  • every folder in the downloads folder gets moved into the mangas folder

so unless the downloads folder did not contain any data, everything that was inside it, will be in the mangas folder

if your data was actually deleted, then you will need to provide steps that are actually able to reproduce this issue

If you insist on defending bad practices then at least a warning should be issued that choosing an existing folder will cause the files to be deleted (or moved as you claim).

all that I'm doing is wondering why someone would save data in some random apps folders, without having knowledge on how this app behaves/works I would assume people aren't doing that with other apps, so what would make it a good idea to do that with suwayomi?

schroda avatar Aug 09 '24 15:08 schroda

moved where exactly (on windows). I can't find it anywhere, it was seemingly deleted.

as was written in my last 2 comments:

the server will just move everything that is not the thumbnails folder into the mangas folder inside of the downloads folder

* `downloads` folder = your chosen download location

* `mangas` folder = sub folder in `downloads` folder

* every folder in the `downloads` folder gets moved into the `mangas` folder

so unless the downloads folder did not contain any data, everything that was inside it, will be in the mangas folder

if your data was actually deleted, then you will need to provide steps that are actually able to reproduce this issue

My folder was empty afterwards. Maybe you can't reproduce it with the latest version?

all that I'm doing is wondering why someone would save data in some random apps folders, without having knowledge on how this app behaves/works I would assume people aren't doing that with other apps, so what would make it a good idea to do that with suwayomi?

In my case the motivation was to select a folder that already had downloaded manga inside so I have all manga, be it downloaded manually or by suwayomi, in one single folder. As said multiple times, there is no indication that it expects an empty folder or that existing data is unwanted.

Anyway the current situation must be improved. How it is dealed with is up to the owners. I can only give suggestions. One of which is to either ignore existing data or import it. Another would be to automatically create a "manga" or "suwayomi" subfolder in the selected download folder. It is unlogical why existing data is moved to a subfolder instead of creating an empty subfolder specifically for the new suwayomi data.
Whatever solution is chosen, there must be a clear indication in the interface about what selecting a download folder does. Could be a simple tooltip.

radry avatar Aug 10 '24 08:08 radry

It is unlogical why existing data is moved to a subfolder instead of creating an empty subfolder specifically for the new suwayomi data.

it does that due to a migration that happened previously it used to be that the folder was structured like so

  • downloads
    • source1
      • manga1
      • manga2
      • ...
    • source2
      • manga1
      • manga2
      • ...
    • ...

but has since moved to

  • downloads
    • thumbnails
      • thumbnail1
      • thumbnail2
      • ...
    • manga
      • source1
        • manga1
        • manga2
        • ...
      • source2
        • manga1
        • manga2
        • ...
      • ...

since we wanted the migration of versions to be automated it moved everything except from the thumbnails folder from the downloads folder to the downloads/manga folder.

creating another sub folder doesn't help since we would still have to move everything from the main downloads folder into the downloads/manga folder to keep version migration viable.

My folder was empty afterwards. Maybe you can't reproduce it with the latest version?

the downloads folder should never be empty since the first thing it does is create manga and thumbnails sub-folders and them move everything else in to the manga folder.

In my case the motivation was to select a folder that already had downloaded manga inside so I have all manga, be it downloaded manually or by suwayomi, in one single folder. As said multiple times, there is no indication that it expects an empty folder or that existing data is unwanted.

is it not just generally computer usage to not point a program at a folder when you don't know what its gonna do with that folder?

Robonau avatar Aug 10 '24 10:08 Robonau

Still an issue, data is deleted (not moved somewhere else) upon restart. Nothing but this tool using the folder / subfolders. Reproduces every time.

mvayala avatar Aug 24 '24 21:08 mvayala

provide a video

schroda avatar Aug 24 '24 21:08 schroda