Repository: cyclotruc/gitingest

Issue:
injest url field isn't case insensitive.
type Https://... with a uppercasee h on mobile and there was a repo not found error.

Hints from issue comments:
@filipchristiansen: > type Https://... with a uppercasee h on mobile and there was a repo not found error.

Thank you for pointing this out! I appreciate you taking the time to report the issue. I'll work on making the URL field case insensitive to fix the problem. Stay tuned for the update!@filipchristiansen: Hi there @jadedgnome,

Thanks again for reporting this! I've addressed the problem by making the URL field case insensitive in the `parse_query` function and added a corresponding test to ensure it works with mixed-case URLs. You can follow the progress and review the changes in this [pull request](https://github.com/cyclotruc/gitingest/pull/115) that resolves this issue.

This fix should resolve the "repo not found" error caused by uppercase letters in the URL. Thanks for your patience, and feel free to let me know if you encounter any further issues!@jadedgnome: thanks for responding so quickly and resolving it!

Solution patch:
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)


Test patch:
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.