Follow-up to #1411. Not a bug today, and explicitly out of scope there — recording it so it is not rediscovered the hard way.
SubmissionUploadFilesComponent.onUploadError decides whether an upload failure was the client-side size-limit rejection by comparing the emitted response against a translated string:
const errorMessageUploadLimit = this.translate.instant('submission.sections.upload.upload-failed.size-limit-exceeded');
const isFileSizeLimitError = error?.response === errorMessageUploadLimit;
The uploader produced that same string with the same one-argument translate.instant(key) call, so today the === holds in every locale. But it is brittle in a way nothing catches:
- adding any interpolation param at either site makes the comparison silently false — no compile error, no failing spec, and eight live customers quietly lose their only actionable oversized-file message;
- it depends on the two
instant() calls resolving in the same locale at the same moment.
#1411 pins the current behaviour with specs and documents the constraint in a TypeDoc block, but does not change the mechanism.
Proposed fix: replace the translated-string discriminator with a locale-independent marker — either response: '<the i18n key>' (not its translation) or an optional sizeLimitExceeded: true on the emitted UploaderError. Verified safe in principle: no other onUploadError consumer on dtq-dev renders error.response.
Related, also deliberately unfixed in #1411:
- MyDSpace's handler branches only on
error.status === 422 and so ignores the size-limit emit's status: 400 — it has no size-limit message at all;
- a locale missing
submission.sections.upload.upload-failed.size-limit-exceeded already renders the raw dotted key in that toast.
Follow-up to #1411. Not a bug today, and explicitly out of scope there — recording it so it is not rediscovered the hard way.
SubmissionUploadFilesComponent.onUploadErrordecides whether an upload failure was the client-side size-limit rejection by comparing the emittedresponseagainst a translated string:The uploader produced that same string with the same one-argument
translate.instant(key)call, so today the===holds in every locale. But it is brittle in a way nothing catches:instant()calls resolving in the same locale at the same moment.#1411 pins the current behaviour with specs and documents the constraint in a TypeDoc block, but does not change the mechanism.
Proposed fix: replace the translated-string discriminator with a locale-independent marker — either
response: '<the i18n key>'(not its translation) or an optionalsizeLimitExceeded: trueon the emittedUploaderError. Verified safe in principle: no otheronUploadErrorconsumer ondtq-devrenderserror.response.Related, also deliberately unfixed in #1411:
error.status === 422and so ignores the size-limit emit'sstatus: 400— it has no size-limit message at all;submission.sections.upload.upload-failed.size-limit-exceededalready renders the raw dotted key in that toast.