Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the "town hall" (meta-discussion site) for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Uploading a 6 MiB avatar returns “413 Request Entity Too Large”.

+2
−1

When I upload a new avatar:

  1. #!/usr/bin/env pwsh
    Start-Process 'https://powerusers.codidact.com/users/edit/profile#user_avatar:~:text=user%20avatar-,Avatar,-An%20optional%20profile'
    
  2. #!/usr/bin/env xdg-open
    (() => {
      const run = () => {
        const fileInput = document.querySelector('#user_avatar');
        const onChange = () => {
          if (fileInput.files && fileInput.files.length > 0) {
            document.querySelector('input.button').click();
          }
          fileInput.removeEventListener('change', onChange);
        };
        fileInput.addEventListener('change', onChange, { once: true });
        fileInput.click();
      };
      if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', run, { once: true });
      } else {
        run();
      }
    })();
    

…if the submitted file is ⪆ 4 MiB:

  1. #!/usr/bin/env sh
    mediainfo --Output=JSON "$HOME/JPEG.JPEG" | yq -P
    
  2. creatingLibrary:
      name: MediaInfoLib
      version: "25.10"
    media:
      '@ref': /home/RokeJulianLockhart/JPEG.JPEG
      track:
        - '@type': General
          ImageCount: "1"
          FileExtension: JPEG
          Format: JPEG
          FileSize: "6404703"
          StreamSize: "17260"
        - '@type': Image
          Format: JPEG
          Width: "3072"
          Height: "3072"
          ColorSpace: YUV
          ChromaSubsampling: 4:4:4
          BitDepth: "8"
          Compression_Mode: Lossy
          StreamSize: "6387443"
          colour_primaries: BT.709
          transfer_characteristics: sRGB/sYCC
          extra:
            ColorSpace_ICC: RGB
            colour_primaries_ICC_Description: GIMP built-in sRGB
    

…the submission fails, with a nondescript error:

<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
<script defer src="[https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015](view-source:https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015)" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon='{"version":"2024.11.0","token":"fa0c13a4688940dfbd0ead60ec559af0","server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}' crossorigin="anonymous"></script>
</body>
</html>

Instead, I should be informed that the image is too large, after which QPixel should allow me to re-upload a new avatar file.

History

1 comment thread

If you really were trying to upload an avatar entirely from the terminal, there's not a lot we can do... (1 comment)

2 answers

+2
−0

Warning earlier in the process

I agree that a 413 error page should not be presented to the user. In addition to replacing this with a user friendly warning, I recommend we do not wait until the user presses save. We could give a warning earlier, at the point of selecting a file. This would be consistent with the warning given when uploading an image to a post.

History

0 comment threads

+1
−0

Attempting to upload an avatar that is too large now produces a warning message and leaves you on the edit page so you can try again. As part of making this change, the maximum upload size is now a configuration parameter -- one that needs to be in sync with webserver configuration, but it's no longer baked into the code.

History

0 comment threads

Sign up to answer this question »