Skip to content

The directory order of "sort by date - descending" is messed up after indexing the folders #751

@bruce30262

Description

@bruce30262

Note: Please always try reproducing the issue on the :edge build. There is a chance that it was already fixed. If it's an UI issue, you can try reporducing it on the demo page.


Describe the bug
This issue happens when I was testing the release of V2.0.0 ( commit 4dc431f ). In the Gallery, if we set the sorting order to "By date - descending", the order of directory will be incorrect after indexing a folder.

To reproduce the issue:

  1. Create a folder called test under Gallery
  2. Prepare two folders in a tmp folder with the following structure:
> tree ./tmp
.
├── new
│   └── new_in
│       └── new.PNG # can be a random picture
└── old
    └── old_in
        └── old.PNG # can be a random picture
  1. Move the old folder into test folder, wait for 1 min
  2. Move the new folder into test folder
  3. Goto the Gallery page of test, set the sorting order to "By date - descending"
  4. Now inside the test gallery, the order of the folders should be correct ( new is in front of old, meaning new is newer ). Both folder have no cover since the folder is not indexed.
  5. Now click the new folder so the folder will be indexed.
  6. Go back to test Gallery and refresh the page. We'll notice that the new folder will be move behind the old folder, which is incorrect since the new folder should be the first folder in the gallery.

The above is just a simple example to demonstrate the issue. In my case ( a Gallery with lots of folder ), this issue messed up the order of lots of folder -- most of them will be "shifted" to the last order ( meaning pigallery2 think it's the oldest even though it's not ) after being indexed.

As for expected behavior: the order of the folders should follow the result of the ls -lt command. For example, if the result is:

new # latest
|
v
...
old # oldest

Then the order of the folders in Gallery should be:

new ->... old

Photo/video (optional) that causes the bug

N/A

Screenshots (optional)

N/A

Server logs (optional)

N/A

Environment (please complete the following information):

  • OS: Server runs on Linux, browser on Windows.
  • Browser: Brave

Used app version:
Using the docker image from here.
Version: V2.0.0
Commit: 4dc431f

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions