-
Notifications
You must be signed in to change notification settings - Fork 354
Description
Steps
- Create a folder
- Put a large number of items in the folder (I reproduced this using 99 items, but it could show up as low 20)
- Request a node list of the folder through the api, for example:
- GET /v2/nodes/yj3tr/files/osfstorage/68ace6c7f431457b7eaffeac/?page=1
- https://api.osf.io/v2/nodes/yj3tr/files/osfstorage/68ace6c7f431457b7eaffeac/?page=1
- View each page
- On the web, you can view the second page with: https://api.osf.io/v2/nodes/yj3tr/files/osfstorage/68ace6c7f431457b7eaffeac/?page=2
- You can use Ctrl-F test_ to quickly scan the files on each page
Expected
All files in the folder are on a page.
Actual
The last file on the first page is repeated on the second and third pages, and displaces the files that should be there.
This happens to:
The output_data/analysis_ready_metadata folder in the compedium I'm working with:
The THINGS-data model folder:
And the testing folder I created (This one is convenient because it's clear that test_11.txt and test_21.txt are replaced by test_1.txt on the second and third pages.)
Potential causes
My guess is that the bug involves sorting the nodes, perhaps in pagination.py. I notice that ordering within JSONAPIPagination is only enforced when the resource is embedded, while in SearchPagination ordering is always enforced. Perhaps moving the ordering to outside the if statement in JSONAPIPagination paginate_queryset would fix the problem?