Skip to content

Make URL input accept "example.com" without requiring "https://" #15

@ieliofficial

Description

@ieliofficial

Currently, the URL input at frontend/src/landingPage.jsx uses new URL(url) which throws an error for URLs like "google.com" - it only accepts full URLs with protocol (e.g., "https://google.com/").

Requirements:

  1. Modify the handleScan function to prepend "https://" to the input if no protocol is provided
  2. After normalization, validate that the URL is valid
  3. Update the error message to be more helpful (e.g., "Please enter a valid website address")
  4. Ensure tests in frontend/src/tests/landingPage.test.jsx pass with new behavior

Test cases to add:

  • "google.com" should work
  • "example.org" should work
  • "localhost:3000" should work
  • Invalid inputs like "not-a-url" should still show error

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions