Apply PR #1 URL normalization suggestions and accept schemeless URLs in FE validation#4
Draft
Apply PR #1 URL normalization suggestions and accept schemeless URLs in FE validation#4
Conversation
Co-authored-by: arhen <15151850+arhen@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
url-shortener | 31c7f25 | Feb 14 2026, 03:02 PM |
Co-authored-by: arhen <15151850+arhen@users.noreply.github.com>
Co-authored-by: arhen <15151850+arhen@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Apply suggestions from merged PR to improve validation
Apply PR #1 URL normalization suggestions and accept schemeless URLs in FE validation
Feb 14, 2026
There was a problem hiding this comment.
Pull request overview
This PR enhances URL input handling by implementing consistent normalization across frontend and backend, allowing users to submit URLs without explicit schemes (e.g., "example.com") while maintaining HTTPS-only enforcement. The changes address edge cases from a previous PR and improve the user experience by accepting schemeless URLs and normalizing them transparently.
Changes:
- Added
normalizeUrlInput()function to trim input and prependhttps://when no URI scheme is present - Integrated normalization into frontend validation via Zod preprocessing while keeping HTTPS-only enforcement
- Simplified paste handler to normalize all non-empty input and submit directly, removing manual error handling
- Hardened backend to trim URLs, reject empty/whitespace-only input, and avoid double-scheme URLs
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/client/lib/validation.ts | Added normalizeUrlInput function and integrated it into urlSchema via z.preprocess, maintains HTTPS-only validation |
| src/client/routes/index.tsx | Simplified paste handler to use normalizeUrlInput and rely on schema validation, removed manual error path, reorganized imports |
| src/api/worker.ts | Added URL trimming, empty string validation, and scheme-checking before normalization to prevent malformed URLs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This addresses the merged PR feedback on URL normalization edge cases and updates frontend validation so inputs without an explicit URI scheme are accepted. The flow now consistently normalizes user input before validation/storage while preserving HTTPS-only enforcement.
Backend normalization hardening (
src/api/worker.ts)original_urlbefore processing.400withURL is requiredfor empty/whitespace-only input.Frontend validation accepts schemeless input (
src/client/lib/validation.ts)normalizeUrlInput()to:https://when scheme is missingz.preprocess(...)inurlSchema.Paste flow aligned with validation (
src/client/routes/index.tsx)Example (normalization behavior)
screenshot
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.