Fix/hardcoded localhost and missing delete endpoint#46
Merged
SatyamPandey-07 merged 2 commits intoJun 29, 2026
Merged
Conversation
handleSubmit referenced an undeclared variable trimmedUrl on line 29, causing every scan submission to throw a ReferenceError before any URL processing could happen. This adds the missing const trimmedUrl = url.trim() declaration, switches the empty-input check to use the trimmed value so whitespace-only input is also rejected, and removes a duplicate https-prefix check that was leftover dead code from the same incomplete edit. Fixes harshika53#41.
RecentScansSection and HistoryPage bypassed the centralised api.ts client and made raw fetch calls to a hardcoded http://localhost:5000, breaking every deployment that sets VITE_API_URL to a non-local backend. This replaces both with calls to the existing getRecentScans and getReports functions in api.ts. Additionally, HistoryPage's delete action called a POST /api/scans/delete endpoint that did not exist anywhere in the Flask backend, causing every delete to silently 404 while the UI still removed the scan from local state, making it reappear on refresh. This adds a deleteScans function to api.ts and a corresponding DELETE /api/scans/delete route in backend/app.py that removes matching documents from MongoDB by id. Verified with tsc --noEmit, npm run build, and python3 -m py_compile, all passing cleanly. Fixes harshika53#42.
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.
RecentScansSection and HistoryPage bypassed the centralised api.ts client and made raw fetch calls to a hardcoded http://localhost:5000, breaking every deployment that sets VITE_API_URL to a non-local backend. This replaces both with calls to the existing getRecentScans and getReports functions in api.ts. Additionally, HistoryPage's delete action called a POST /api/scans/delete endpoint that did not exist anywhere in the Flask backend, causing every delete to silently 404 while the UI still removed the scan from local state, making it reappear on refresh. This adds a deleteScans function to api.ts and a corresponding DELETE /api/scans/delete route in backend/app.py that removes matching documents from MongoDB by id. Verified with tsc --noEmit, npm run build, and python3 -m py_compile, all passing cleanly. Fixes #42.