Skip to content

Use 20-character random names for upload-only AI chat files - #358

Merged
polterguy merged 2 commits into
masterfrom
fix/tmp-uploads-no-cache
Nov 5, 2026
Merged

polterguy merged 2 commits into
masterfrom
fix/tmp-uploads-no-cache

Conversation

@barnascript

@barnascript barnascript commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Upload-only files in magic.ai.chat.hl now get 20 random characters instead of 10. Files sent to the LLM already get 25.

The earlier C# change, which forced no-cache headers for /etc/www/tmp/ in the static file server, was removed after review: no folder-specific code in C#. Caching of /tmp/ is handled on the Cloudflare side instead, with a cache rule that bypasses the cache for /tmp/*.

…y files

Files in /etc/www/tmp/ are public only so an LLM can fetch them by their random URL.
The default /etc/www/.config caches every static file with
'Cache-Control: public, max-age=31536000', which a CDN such as Cloudflare honours,
so an upload kept being served from the CDN for up to a year after it was deleted.

The static file server now overrides whatever .config says for anything under
/etc/www/tmp/: Cache-Control no-store/private/max-age=0, CDN-Cache-Control and
Cloudflare-CDN-Cache-Control no-store, Pragma no-cache, Expires 0, and
X-Robots-Tag noindex/nofollow/noarchive. Double slashes and backslashes are
normalised before the check. Every other static file is unchanged.

Upload-only files in magic.ai.chat.hl now get 20 random characters instead of 10
(files sent to the LLM already get 25).

Tests: two new tests in FileExecutorConfigTests (fail on master, pass here);
magic.endpoint.tests 98/98 green on .NET 10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per review: no folder-specific code in C#. This PR now only raises upload-only
file names in magic.ai.chat.hl from 10 to 20 random characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@barnascript barnascript changed the title Never cache AI chat uploads in /etc/www/tmp/; 20-character names for upload-only files Use 20-character random names for upload-only AI chat files Nov 5, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

@polterguy
polterguy merged commit d5e0d00 into master Nov 5, 2026
9 checks passed
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.

2 participants