Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b2c9ec2

Browse files
fix: improve empty repository URL error
1 parent aca371a commit b2c9ec2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

‎src/gitingest/query_parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ async def parse_remote_repo(source: str, token: str | None = None) -> IngestionQ
4040
A dictionary containing the parsed details of the repository.
4141
4242
"""
43+
if not source.strip():
44+
msg = "Invalid repository URL: cannot be empty or spaces only."
45+
raise ValueError(msg)
46+
4347
parsed_url = await _normalise_source(source, token=token)
4448
host = parsed_url.netloc
4549
user, repo = _get_user_and_repo_from_path(parsed_url.path)

‎src/server/models.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ class IngestRequest(BaseModel):
4747
@field_validator("input_text")
4848
@classmethod
4949
def validate_input_text(cls, v: str) -> str:
50-
"""Validate that ``input_text`` is not empty."""
51-
if not v.strip():
52-
err = "input_text cannot be empty"
53-
raise ValueError(err)
50+
"""Validate ``input_text`` field."""
5451
return removesuffix(v.strip(), ".git")
5552

5653
@field_validator("pattern")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /