Skip to content

Conversation

@tgoetten
Copy link

@tgoetten tgoetten commented Feb 9, 2026

Description

This PR makes the avatar upload size limit configurable via the S3_AVATAR_UPLOAD_LIMIT environment variable, instead of being hardcoded to 2MB.

Closes #374

Changes

  • apps/web/src/pages/api/upload/avatar.ts: Read MAX_SIZE_BYTES from environment variable with 2MB default
  • .env.example: Added S3_AVATAR_UPLOAD_LIMIT example
  • README.md: Documented the new environment variable

Motivation

Self-hosted instances may have different storage constraints and user requirements. This change allows administrators to configure the avatar upload limit without modifying source code.

Usage

# In .env file - set to 10MB
S3_AVATAR_UPLOAD_LIMIT=10485760

If not set, the default remains 2MB (2097152 bytes) for backward compatibility.

Testing

  1. Set S3_AVATAR_UPLOAD_LIMIT=10485760 in .env
  2. Restart the application
  3. Upload an avatar larger than 2MB but smaller than 10MB
  4. Verify upload succeeds

Checklist

  • Code follows the project's coding style
  • Changes are backward compatible (default behavior unchanged)
  • Documentation updated (README.md, .env.example)

@program-the-brain-not-the-heartbeat
Copy link
Contributor

Hi @tgoetten,

Thank you for your PR! I've went ahead and tested this on my development machine.

It does reject larger files provided by the environment variable as well as a successful upload of an image smaller than the maximum, but it seems there is no visual feedback of an error message after the POST request.

It returns a HTTP status of 400 (bad request) with the JSON body of:

{"error":"File too large"}

But I don't get a toast notification or any visual feedback that an error occurred.

@tgoetten
Copy link
Author

Hi @program-the-brain-not-the-heartbeat,
thank you for testing the PR and for the feedback!

You're right that there's no toast notification for this error. However, I noticed that several other error cases in the application also only log to the browser console without visual feedback.

I'd suggest keeping this PR focused on the backend configuration change, and addressing the toast notifications as a separate improvement that could cover all upload error cases consistently (avatars, attachments, etc.).

Would you be open to merging this as-is and tracking the UI feedback enhancement in a separate issue/PR? I'm happy to create that issue if you'd like.

@program-the-brain-not-the-heartbeat
Copy link
Contributor

Yes, I 100% agree, let's leave the user feedback/notification defects in a separate issue.

@hjball
Copy link
Contributor

hjball commented Feb 11, 2026

lgtm @tgoetten, you'll also need to add this to:

  • /docker-compose.yml
  • /turbo.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make avatar upload size limit configurable via environment variable

3 participants