Skip to content

fix: prevent incorrect scheme addition in URL parsing#1

Open
rjvkn wants to merge 1 commit intocyinnove:mainfrom
rjvkn:main
Open

fix: prevent incorrect scheme addition in URL parsing#1
rjvkn wants to merge 1 commit intocyinnove:mainfrom
rjvkn:main

Conversation

@rjvkn
Copy link
Copy Markdown

@rjvkn rjvkn commented May 8, 2025

Description

This PR resolves an issue in the tldify.Parse function where URLs with either the http:// or https:// scheme were incorrectly being parsed with an additional scheme. The problem occurred because the function was always prepending http://, even when the URL already had one of these schemes.

Changes

  • The logic in Parse was modified to check whether the URL already starts with http:// or https:// before prepending any scheme.

Motivation and Context

This change prevents incorrect scheme duplication and ensures that URLs like https://example.com are handled correctly.

How to Test

You can test this fix by passing URLs like https://example.com and checking that the function does not prepend http:// again. Any URLs without a scheme should receive http:// as expected.

Screenshots (if applicable)

image

Checklist

  • I have read the contributing guidelines.
  • My code follows the code style of this project.
  • I have tested my change.

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.

1 participant