Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rating an individual doc blows up #228

Closed
epugh opened this issue Oct 22, 2020 · 1 comment · Fixed by #233
Closed

Rating an individual doc blows up #228

epugh opened this issue Oct 22, 2020 · 1 comment · Fixed by #233
Assignees

Comments

@epugh
Copy link
Member

epugh commented Oct 22, 2020

Describe the bug
Appears that what we think an "id" is can blow up. http://app.quepid.com/api/cases/3934/queries/95681/ratings/FW393001

Possibly unhandled rejection: {"data":{"status":"500","error":"Internal Server Error"},"status":500,"config":{"method":"PUT","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/api/cases/3934/queries/95681/ratings/FW393001","data":{"rating":1},"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json;charset=utf-8","X-CSRF-TOKEN":"FAPyFvA3KITzOAhjx4k1WpcXTOtnznJ5xKk9NHSXN0v8AszKDwmHdGB+FOQMiS9rX1dDNx1pdigUEOMjTGqE1g==","X-Requested-With":"XMLHttpRequest"}},"statusText":"Internal Server Error","xhrStatus":"complete"}

To Reproduce
Steps to reproduce the behavior:

  1. Go to http://app.quepid.com/case/3934/try/NaN?sort=default
  2. Rate a doc, notice nothing changes
  3. See error

Expected behavior
It should rate!

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@epugh epugh self-assigned this Oct 22, 2020
@epugh
Copy link
Member Author

epugh commented Oct 27, 2020

What I've discovered is that our logic to detect if a "docid" is base64 encoded or not turns out to work in all cases. For example, this doc id: SHFGS700 is considered base 64 encoded value!

@controller.id_base64? "SHFGS700"

The reason we do base64 encoding is because our routing logic looks like:

PUT http://app.quepid.com/api/cases/3934/queries/95681/ratings/SHFGS700 with a payload of

{"rating":"2"}

So, if the doc id has a . or a / in it, then we have issues, so we base64 encode.

However, what if we do this:

PUT http://app.quepid.com/api/cases/3934/queries/95681/ratings with a payload of

{
  {"doc_id":"SHFGS700", "rating":"2"}
}

Then we don't care if there is a . or a / in the name of the doc!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant