Today I Learned
How Flask / Werkzeug determines file from regular form data in multipart requests
June 25, 2026TIL how Flask / Werkzeug uses the filename parameter in the Content-Disposition header of a multipart/form-data HTTP request to determine if it should treat the part like a file or a regular form field.
One of the clients was sending files without filename and was getting a EntityTooLarge (413) response, even though the files sent were below the MAX_CONTENT_LENGTH limit, which initially left us confused. Why do we receive EntityTooLarge for a request that is below our threshold? It turns out, the request was missing the filename property, so Flask / Werkzeug loads it as a form and applies MAX_FORM_MEMORY_SIZE.
This can be seen from werkzeug/formparser.py
if field_size > self.max_form_memory_size:
raise RequestEntityTooLarge()
And from werkzeug/sansio/multipart.py
filename = extra.get("filename")
if filename is not None:
event = File(
filename=filename,
headers=headers,
name=name,
)
else:
event = Field(
headers=headers,
name=name,
)
Scroll To Text Fragment
March 12, 2025TIL that you can link to a specific text on a webpage by appending #:~:text= to the url, .e.g. https://en.wikipedia.org/wiki/Tree#:~:text=Trees evolved around 370 million years ago. It’s called Text Fragment.
Python Dependency Checker
February 27, 2025I discovered Tach, a static code checker for Python projects to enforce dependencies between modules. For example in a layered backend architecture you can enforce that controller modules can only depend on service and repository modules and, e.g. repository modules cannot import from controller modules. Looks interesting also to enforce code boundaries between modules (or components) in a modular monolith. I’d like to check it out in one of my next projects.
Vite Proxy Server
February 25, 2025Today I learned that Vite has a proxy server config so that in local development API requests can go to http://localhost:3000/api while the server can run on http://localhost:5000. This saves you from having to configure CORS in the backend for local dev purposes only.
JSDOM
February 24, 2025Blog post by Artem Zakharchenko (creator of MSW) about JSDOM, the issues with re-implementing a browser env in Node, and alternatives like Vitest Browser Mode.
Figma/Tailwind Semantic Design Tokens Tutorial
February 24, 2025Epicweb.dev has a great, free tutorial on how to use semantic tokens with Tailwind and Figma.