getgrav / grav-plugin-admin

Grav Admin Plugin
http://getgrav.org
MIT License
355 stars 227 forks source link

Duplicate page file created when using 3-digit ordering prefixes #2257

Closed hughbris closed 2 years ago

hughbris commented 2 years ago

When users edit files with three digit prefixes, the Save Location is reported as its current location correctly, e.g. "Save location: user/pages/40.recipes/010.preserved-lemon-risotto".

After saving, there's a new file with a two digit prefix, so user/pages/40.recipes/010.preserved-lemon-risotto in this example.

I got a little lost tracking this down in a hurry, but it seems two digits are hardcoded into an expression somewhere.

I'm not sure how to even work around this as some folders have more than 99 subpages, so two isn't enough. Is there an event I can hook into to force the prefix to three digits in some cases?

Cheers

hughbris commented 2 years ago

I don't know where I got the idea that 3-digit prefixes need a leading zero, possibly from 2-digit ones and just my sorting brain!

I took the (first) leading zero off folders below 100. Now saves and adds seem to work as expected, so this is probably a developer error. (I originally created the pages using a script from a DB.)

Still a question mark over what the default sort of folders with 2- and 3-digit prefixes will be. For me, this time, it doesn't matter and it probably won't come up again for some time.