storage
storage copied to clipboard
Storage list sort order
Sequential numerical filenames don't sort properly.
In Storage, if we have if we have 1.png, 10.png, 11.png, ..., 2.png, 20.png, 21.png, In Finder on Mac, these items would be sorted: 1.png, 2.png, 3.png, ... 10.png, 11.png, etc.
Storage on top, Finder on bottom:
Shifting this issue to storage-api, the sorting of the files are not on the client side
This is expected, as the ORDER BY clause on a string in Postgres does not take into account the number cardinality, I would recommend sorting by created_at.
Alternatively, if the formatted order is important you can always create an RPC function that will allow you to normalize the string and sort by the numeric value
for example:
SELECT *
FROM objects
ORDER BY split_part(name, '.', 1)::numeric;