Skip to content

fix: improve empty repository URL error #454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/gitingest/query_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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)
Expand Down
5 changes: 1 addition & 4 deletions src/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down