lyc8503 / onedrive-cf-index-ng

Another OneDrive public directory listing on Docker / Cloudflare Workers, forked from onedrive-vercel-index.
MIT License
238 stars 303 forks source link

Support numerical order #31

Closed arm64x closed 4 days ago

arm64x commented 4 days ago

Hello, can you support with sorting files by numerical order?

For example: 01, 02...09,10,11...99,100,101

Currently it is sorting by lexicographical order: 01, 02...09,10,100,101...109,11,110

Thank

lyc8503 commented 4 days ago

This can be difficult, as the current implementation returns the contents of the folder in a paged fashion, and the order in which they are returned is determined by Microsoft's API: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children

and this API does not support sorting by numerical order: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/optional-query-parameters

Maybe for now you have to prepopulate the zeroes so that the lexicographical order matches the numerical order, something like: 0001,0002,... ,0010,... ,0100,...