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