feat(files): FILE_UPLOAD_LIMIT_MB sets the upload limit for files and notes

The 50 MB limit for files, booking attachments and note attachments becomes FILE_UPLOAD_LIMIT_MB, 50 by default. The server hands it to the client through the app config, so the upload dialogs refuse a file over it up front and say what the limit is; on desktop a file over it no longer vanishes without a word. (#1364)
This commit is contained in:
Maurice
2026-10-01 11:56:14 +02:00
parent 750b178d5b
commit 885896aba2
42 changed files with 93 additions and 41 deletions
@@ -43,6 +43,7 @@ export function useFileManager({ files = [], onUpload, onDelete, onUpdate, place
const can = useCanDo()
const trip = useTripStore((s) => s.trip)
const currentUser = useAuthStore((s) => s.user)
const maxUploadMb = useAuthStore((s) => s.maxUploadMb)
const canManageSync = canManageDocSync(currentUser, trip)
const docSyncOffered = useDocSyncOffered(tripId, canManageSync)
const { t, locale } = useTranslation()
@@ -137,7 +138,13 @@ export function useFileManager({ files = [], onUpload, onDelete, onUpdate, place
const { getRootProps, getInputProps, isDragActive } = useDropzone({
onDrop,
maxSize: 50 * 1024 * 1024,
maxSize: maxUploadMb * 1024 * 1024,
// A file over the limit used to vanish without a word; say why it was left out.
onDropRejected: rejections => {
if (rejections.some(r => r.errors.some(e => e.code === 'file-too-large'))) {
toast.error(t('files.uploadErrorSize', { max: maxUploadMb }))
}
},
noClick: false,
})