diff --git a/src/gitingest/query_parser.py b/src/gitingest/query_parser.py index dc4ccdef..65b0df0c 100644 --- a/src/gitingest/query_parser.py +++ b/src/gitingest/query_parser.py @@ -43,6 +43,10 @@ async def parse_remote_repo(source: str, token: str | None = None) -> IngestionQ A dictionary containing the parsed details of the repository. """ + if not source.strip(): + msg = "Invalid repository URL: cannot be empty or spaces only." + raise ValueError(msg) + parsed_url = await _normalise_source(source, token=token) host = parsed_url.netloc user, repo = _get_user_and_repo_from_path(parsed_url.path) diff --git a/src/server/models.py b/src/server/models.py index 97739416..be581eb3 100644 --- a/src/server/models.py +++ b/src/server/models.py @@ -49,10 +49,7 @@ class IngestRequest(BaseModel): @field_validator("input_text") @classmethod def validate_input_text(cls, v: str) -> str: - """Validate that ``input_text`` is not empty.""" - if not v.strip(): - err = "input_text cannot be empty" - raise ValueError(err) + """Validate ``input_text`` field.""" return removesuffix(v.strip(), ".git") @field_validator("pattern")