Repository navigation
fix(upload): skip .git, node_modules and secret files before folder upload - #644
Merged
Merged
Conversation
…pload Folder uploads sent every file under the selected directory. The backend rejects the whole request when any path segment is .git, .env*, .ssh, .aws, .npmrc, .pypirc or .netrc, and node_modules/.git/.venv pushed normal repos over the 25 MB client limit, so most real projects failed. Filter folder uploads in the browser before the size check and FormData: - folders in analyst/analyzer.py IGNORED_DIRS (mirrored exactly, so the analysis result is unchanged) - segments normalize_uploaded_filename refuses, matched case-insensitively - private-key-like files (id_rsa, id_ed25519, *.pem, *.key) If nothing is left, show the existing empty-graph error without calling the backend; on success, mention how many files were skipped. A single .zip upload is sent unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assert the skipped-files toast does not fire when nothing was skipped, and that a .git file (as in a git submodule) is skipped like the backend rejects it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 21, 2026
Closed
madara88645
marked this pull request as ready for review
October 21, 2026 16:46
This was referenced Oct 21, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / why
Folder uploads ("Browse Folder") sent every file under the selected directory,
.git/andnode_modules/included. Real projects hit two failures:normalize_uploaded_filename(app/utils/security.py) rejects the whole upload with HTTP 400 if any path segment is.git,.ssh,.aws,.npmrc,.pypircor.netrc, or starts with.env. So uploading any folder that contains.git(or a.env.examplefile) failed.getTotalUploadSizecountednode_modules,.git,.venvand similar folders toward the 25 MB client limit, so ordinary JS and Python repos were often rejected as "too large".This PR changes the frontend only. The backend and its validators are untouched.
How
explorer/src/utils/uploadFilter.jsexportsshouldSkipUploadPath(relativePath). It turns backslashes into slashes and checks every segment, including the top folder thatwebkitRelativePathadds. A file is skipped when:IGNORED_DIRSfromanalyst/analyzer.py(.git,node_modules,site-packages,venv,env,.venv,__pycache__). The list is mirrored exactly and matched case-sensitively, like the analyzer, so the analysis does not change._JS_IGNORED_DIRS(dist,build, ...) is not mirrored: it is only used for JS import resolution, and the analyzer still analyzes files in those folders..gitfile, as in git submodules.id_rsa,id_dsa,id_ecdsa,id_ed25519,*.pem,*.key), so these key files never leave the browser.ProjectUpload.uploadFiles()applies the filter before the size check and before buildingFormData.Upload failed: No analyzable code found…error and does not call the backend.Skipped N files (.git, node_modules, .env and similar) — they aren't analyzed..zipupload is sent unchanged, exactly as before.How verified
npx vitest run src/utils/uploadFilter.test.js src/components/ProjectUpload.test.jsx: 33 passed.node_modules, the top-folder prefix,.env.local, case-insensitivity, backslashes, a submodule.gitfile, a normalsrcfile kept,.gitignorekept, andbuild//dist/kept.FormData, that they don't count toward the size limit, that no fetch happens when everything is skipped, and that no skip toast fires when nothing was skipped.ProjectUpload.jsxput back, the new component tests fail, so they catch the bug.npx eslinton the changed files: clean.Out of scope / follow-ups
handleDropsendse.dataTransfer.files. The WICG Entries API spec treats a dropped directory as one File-kind item ("If it is accessed viagetAsFile()a zero-lengthFileis returned"). Its contents are only reachable throughwebkitGetAsEntry()plus repeatedreadEntries()calls. Not tested in a browser. Needs its own PR.normalize_uploaded_filename, so a zip that contains.git/or.env.exampleis rejected as "Unsafe zip file detected". The backend also extracts every uploaded.zip, not just a lone one. So a folder that contains a nested fixture zip with such members still fails. Fixing either is a backend change and needs owner approval.🤖 Generated with Claude Code