javascript: parse the upload status code correctly

Previously the status was "Status: 422" instead of just 422.
This commit is contained in:
Pierre de La Morinerie 2020-04-16 12:53:32 +02:00
parent ef5e5977fc
commit b006c33ebe

View file

@ -51,8 +51,8 @@ export default class FileUploadError extends Error {
// (so that Sentry knows they are different kind of errors, from
// the line they were created.)
export function errorFromDirectUploadMessage(message) {
let matches = message.match(/ Status: [0-9]{1,3}/);
let status = (matches && parseInt(matches[0], 10)) || undefined;
let matches = message.match(/ Status: ([0-9]{1,3})/);
let status = matches ? parseInt(matches[1], 10) : undefined;
// prettier-ignore
if (message.includes('Error reading')) {