fix file size limit

This commit is contained in:
lendry
2026-07-07 15:42:45 +03:00
parent ca2e30af04
commit 9a0cf54aa6
3 changed files with 29 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ import {
const ANDROID_PLATFORM = 'ANDROID' as const;
const APK_ACCEPT = '.apk,application/vnd.android.package-archive';
const MAX_RELEASE_FILE_BYTES = 350 * 1024 * 1024;
function formatBytes(value: string) {
const size = Number(value);
@@ -83,6 +84,10 @@ export default function AdminReleasesPage() {
showToast('Выберите файл релиза');
return;
}
if (file.size > MAX_RELEASE_FILE_BYTES) {
showToast('APK не должен превышать 350 МБ');
return;
}
const parsedVersionCode = Number(versionCode);
if (!version.trim() || !Number.isInteger(parsedVersionCode) || parsedVersionCode < 1) {
showToast('Укажите версию и положительный код версии');

View File

@@ -1809,6 +1809,13 @@ export async function uploadAdminAppRelease(
if (!response.ok) {
const body = await response.json().catch(() => ({}));
if (response.status === 413) {
throw new ApiError(
'Файл слишком большой для загрузки (лимит сервера). Максимальный размер APK — 350 МБ. Попросите администратора обновить nginx: ./install.sh --fix-proxy',
413,
'UPLOAD_TOO_LARGE'
);
}
const message = typeof body?.message === 'string' ? body.message : 'Не удалось загрузить релиз';
throw new ApiError(message, response.status, 'UPLOAD_FAILED');
}