fix(upload): restore configurable batch-size for reverse proxies (#509)
Regression of #208. PR #214 (commit02a46e0, re-merged at9b7495e) shipped the configurable `general_max_upload_batch_size_mb` setting so users behind Cloudflare Tunnel and other reverse proxies with per-request size caps could lower the chunked-upload size below their proxy's limit. Six days later the "Merge main into beta for release/beta-to-main" commit (28793bb) resolved its conflict by keeping main's older tree — which silently deleted the migration (072), the setting input on Settings → General, the i18n strings, the `useSettingsState` field, and the read in PhotoUpload.tsx, putting the hardcoded 500MB chunk back. Galleries fronted by Cloudflare have quietly been broken on batch uploads since then. Re-applying exactly the same change set: - `backend/migrations/core/072_add_max_upload_batch_size.js` recreated, with a comment pointing at the regression in case the same merge accident happens again. - `frontend/src/components/admin/PhotoUpload.tsx` line 168 now reads the setting from query cache and falls back to 95MB (Cloudflare-safe headroom under 100MB). - `useSettingsState.ts`, `GeneralTab.tsx`, `en.json`, `de.json` — added the field to the state type + defaults + load path + the Site-Configuration input. Existing installs are safe either way: - Ran original 072 then lost the file: migrations table still has the filename, so the runner skips re-applying. The setting row in `app_settings` is also untouched (the deletion was source-only, no down migration ran). Now the new code starts reading it again. - Installed after the regression: migrations runner picks up the new 072 normally and seeds the setting at 95.
This commit is contained in:
@@ -16,6 +16,8 @@ export interface GeneralSettings {
|
||||
max_file_size_mb: number;
|
||||
max_files_per_upload: number;
|
||||
allowed_file_types: string;
|
||||
// #509 — re-added after the main-into-beta merge dropped it.
|
||||
max_upload_batch_size_mb: number;
|
||||
enable_analytics: boolean;
|
||||
enable_registration: boolean;
|
||||
maintenance_mode: boolean;
|
||||
@@ -91,6 +93,7 @@ export function useSettingsState() {
|
||||
max_file_size_mb: 50,
|
||||
max_files_per_upload: 500,
|
||||
allowed_file_types: 'jpg,jpeg,png,gif,webp',
|
||||
max_upload_batch_size_mb: 95,
|
||||
enable_analytics: true,
|
||||
enable_registration: false,
|
||||
maintenance_mode: false,
|
||||
@@ -177,6 +180,7 @@ export function useSettingsState() {
|
||||
Math.max(1, toNumber(settings.general_max_files_per_upload, 500))
|
||||
),
|
||||
allowed_file_types: settings.general_allowed_file_types || 'jpg,jpeg,png,gif,webp',
|
||||
max_upload_batch_size_mb: toNumber(settings.general_max_upload_batch_size_mb, 95),
|
||||
enable_analytics: toBoolean(settings.general_enable_analytics, true),
|
||||
enable_registration: toBoolean(settings.general_enable_registration, false),
|
||||
maintenance_mode: toBoolean(settings.general_maintenance_mode, false),
|
||||
|
||||
@@ -162,6 +162,28 @@ export const GeneralTab: React.FC<GeneralTabProps> = ({
|
||||
{t('settings.general.maxFilesPerUploadHelp', { max: MAX_FILES_PER_UPLOAD_LIMIT })}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-1">
|
||||
{t('settings.general.maxUploadBatchSize')}
|
||||
</label>
|
||||
<Input
|
||||
type="number"
|
||||
value={generalSettings.max_upload_batch_size_mb}
|
||||
onChange={(e) => {
|
||||
const parsed = parseInt(e.target.value, 10);
|
||||
setGeneralSettings(prev => ({
|
||||
...prev,
|
||||
max_upload_batch_size_mb: Number.isFinite(parsed)
|
||||
? Math.max(1, parsed)
|
||||
: prev.max_upload_batch_size_mb
|
||||
}));
|
||||
}}
|
||||
min="1"
|
||||
/>
|
||||
<p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">
|
||||
{t('settings.general.maxUploadBatchSizeHelp')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user