diff --git a/package.json b/package.json index 329b95e55..4fc01f71b 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "mime-types": "^2.1.35", "mobx": "^4.15.4", "mobx-react": "^6.3.1", - "mobx-utils": "^6.0.5", + "mobx-utils": "^4.0.1", "natural-sort": "^1.0.0", "node-fetch": "2.6.7", "node-htmldiff": "^0.9.4", diff --git a/server/routes/api/documents.ts b/server/routes/api/documents.ts index 6aea0b7a2..ab027e222 100644 --- a/server/routes/api/documents.ts +++ b/server/routes/api/documents.ts @@ -1068,9 +1068,12 @@ router.post("documents.import", auth(), async (ctx) => { throw InvalidRequestError("Request type must be multipart/form-data"); } - // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call. - const file = Object.values(ctx.request.files)[0]; - assertPresent(file, "file is required"); + const file = ctx.request.files + ? Object.values(ctx.request.files)[0] + : undefined; + if (!file) { + throw InvalidRequestError("Request must include a file parameter"); + } if (env.MAXIMUM_IMPORT_SIZE && file.size > env.MAXIMUM_IMPORT_SIZE) { throw InvalidRequestError( diff --git a/yarn.lock b/yarn.lock index 2bc868a22..382431157 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10968,10 +10968,10 @@ mobx-react@^6.3.1: dependencies: mobx-react-lite "^2.2.0" -mobx-utils@^6.0.5: - version "6.0.5" - resolved "https://registry.yarnpkg.com/mobx-utils/-/mobx-utils-6.0.5.tgz#0cce9afb07fbba1fb559f959f8cea1f44baa7252" - integrity sha512-QOduwicYedD4mwYZRl8+c3BalljFDcubg+PUGqBkn8tOuBoj2q7GhjXBP6JXM9J+Zh+2mePK8IoToeLfqr3Z/w== +mobx-utils@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/mobx-utils/-/mobx-utils-4.0.1.tgz#1bd8648332be7ca83d7023aaa0ba24bbf389a300" + integrity sha512-hWYLNJNBoGY/iQbQuOzYkUsTGArpTTutrXaQQrXvxBMefDwhWyNHr7bx/g7syf6KQ1f6aKzgQICqC+zXSvGzJQ== mobx@^4.15.4: version "4.15.7"