diff --git a/src/gitingest/parse_query.py b/src/gitingest/parse_query.py index 4c63a36..f232e63 100644 --- a/src/gitingest/parse_query.py +++ b/src/gitingest/parse_query.py @@ -48,6 +48,9 @@ def parse_query( A dictionary containing the parsed query parameters, including 'max_file_size', 'ignore_patterns', and 'include_patterns'. """ + # Normalize and clean up the source string to make it case-insensitive + source = source.lower().strip() + # Determine the parsing method based on the source type if from_web or source.startswith("https://") or "github.com" in source: query = _parse_url(source) diff --git a/tests/test_parse_query.py b/tests/test_parse_query.py index fed1887..ecca306 100644 --- a/tests/test_parse_query.py +++ b/tests/test_parse_query.py @@ -66,6 +66,16 @@ def test_parse_query_basic() -> None: assert "*.txt" in result["ignore_patterns"] +def test_parse_query_mixed_case() -> None: + """ + Test `parse_query` with mixed case URLs. + """ + url = "Https://GitHub.COM/UsEr/rEpO" + result = parse_query(url, max_file_size=50, from_web=True) + assert result["user_name"] == "user" + assert result["repo_name"] == "repo" + + def test_parse_query_include_pattern() -> None: """ Test `parse_query` with an include pattern.