Location API returns data when offset is greater than the number of locations
Please confirm you have done the following before posting your bug report:
- [x] I have enabled debug mode
- [x] I have read checked the Common Issues page
Describe the bug The GET method of the location API can specify an offset, but if the value is larger than the total number of locations, the data when offset=0 will be returned. When offset is equal to the total number of locations, nothing will be displayed. This is normal behavior. If I set offset from 0 to a value equal to the total number of locations, it works fine. I have confirmed that it works in both my environment and the Snipe-IT demo environment.
To Reproduce Steps to reproduce the behavior:
- Go to https://snipe-it.readme.io/reference#locations
- Set offset = 11 or larger than the total number of locations
- Click Try It
- Confirm rows[0] has id = 1
- and set offset = 10
- Click Try It
- Confirm rows is empty
Expected behavior if the value is larger than the total number of locations, rows will be empty. Other APIs such as hardware work this way.
Screenshots If applicable, add screenshots to help explain your problem.
Server (please complete the following information):
- Snipe-IT Version 5.0.11
- OS: Ubuntu 18.04
- Web Server: Apache (on Docker)
- PHP 7.2.24
Desktop (please complete the following information):
- OS: Windows 10
- Browser chrome
- Windows 10]
Error Messages
- WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
- If a stacktrace is provided in the error, include that too.
- Any errors that appear in your browser's error console.
- Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo.
- Include any additional information you can find in
storage/logsand your webserver's logs. - Include the output from
php -m(this should display what modules you have enabled.)
Additional context
- Fresh Install
- Ubuntu 18.04, Snipe-it 5.0.11
- Installed with docker
- Every other functions works.
Add any other context about the problem here.
Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
This is weird... In the history of the file I found that commit b725e788ec2935b87e353ddf7bfc78a74a2c0b4e re-introduced this behavior when previously commit 3361b859c05b3c3f74ef3a1a66c648190ee76a54 already had fixed it. Just mentioned in case is necessary for the selectlist search feature.
The fix has been merged, so I think is safe to close this issue.