snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Location API returns data when offset is greater than the number of locations

Open uchida140964 opened this issue 5 years ago • 3 comments

Please confirm you have done the following before posting your bug report:

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:

  1. Go to https://snipe-it.readme.io/reference#locations
  2. Set offset = 11 or larger than the total number of locations
  3. Click Try It
  4. Confirm rows[0] has id = 1
  5. and set offset = 10
  6. Click Try It
  7. 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/logs and 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.

uchida140964 avatar Jan 22 '21 08:01 uchida140964

👋 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.

welcome[bot] avatar Jan 22 '21 08:01 welcome[bot]

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.

inietov avatar Feb 26 '21 11:02 inietov

The fix has been merged, so I think is safe to close this issue.

inietov avatar Mar 01 '21 17:03 inietov