Raise mobile upload limits
This commit is contained in:
parent
08c9cc4efb
commit
d90f8bd645
@ -21,6 +21,12 @@ export const createSubmission = async (
|
||||
onProgress?: (progress: number) => void
|
||||
): Promise<CreateSubmissionResponse> =>
|
||||
new Promise((resolve, reject) => {
|
||||
const maxUploadBytes = 64 * 1024 * 1024;
|
||||
if (input.file.size > maxUploadBytes) {
|
||||
reject(new Error("That image is too large for the current upload limit. Please choose a smaller photo."));
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("file", input.file);
|
||||
formData.append("displayName", input.displayName ?? "");
|
||||
@ -48,7 +54,13 @@ export const createSubmission = async (
|
||||
return;
|
||||
}
|
||||
|
||||
reject(new Error((request.response as { message?: string } | null)?.message ?? "Upload failed."));
|
||||
const responseMessage = (request.response as { message?: string } | null)?.message;
|
||||
if (request.status === 413) {
|
||||
reject(new Error("That image is too large for the current upload limit. Please choose a smaller photo."));
|
||||
return;
|
||||
}
|
||||
|
||||
reject(new Error(responseMessage ?? `Upload failed (${request.status || "network"}).`));
|
||||
});
|
||||
|
||||
request.addEventListener("error", () => {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
client_max_body_size 64m;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
@ -214,7 +214,7 @@ const createSubmissionFromMultipart = async (
|
||||
export const buildServer = async () => {
|
||||
const app = Fastify({
|
||||
logger: true,
|
||||
bodyLimit: 25 * 1024 * 1024
|
||||
bodyLimit: 64 * 1024 * 1024
|
||||
});
|
||||
|
||||
const store = new StateStore(config.stateFile);
|
||||
@ -265,7 +265,7 @@ export const buildServer = async () => {
|
||||
await app.register(multipart, {
|
||||
limits: {
|
||||
files: 1,
|
||||
fileSize: 25 * 1024 * 1024
|
||||
fileSize: 64 * 1024 * 1024
|
||||
}
|
||||
});
|
||||
await app.register(fastifyStatic, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user