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

500 internal server error when sending malformed If-Match #38

Open
untitaker opened this issue Sep 24, 2015 · 0 comments
Open

500 internal server error when sending malformed If-Match #38

untitaker opened this issue Sep 24, 2015 · 0 comments

Comments

@untitaker
Copy link

When sending a PUT-request with a header like If-Match: "lolnope", reStore will return a 500 internal server error. The stacktrace acquired with #25 is:

  TypeError: Cannot read property '0' of null
    at Storage.getVersion (/home/untitaker/projects/restore/lib/controllers/storage.js:144:52)
    at null.put (/home/untitaker/projects/restore/lib/controllers/storage.js:69:22)
    at Restore.dispatch (/home/untitaker/projects/restore/lib/restore.js:139:46)
    at IncomingMessage.<anonymous> (/home/untitaker/projects/restore/lib/restore.js:82:10)
    at emitNone (events.js:67:13)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:429:9)
    at process._tickDomainCallback (node.js:384:17)

I think the best solution is to refactor reStore to compute the full etag value for the target file, and compare etags/versions as strings instead of integers. That would take care of this problem in a way that doesn't require special handling for parsing errors.

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

No branches or pull requests

1 participant