routes: fix ruff formatting
Some checks failed
CI / Lint & Format (push) Failing after 30s
CI / Unit Tests (push) Has been skipped
CI / Memory Leak Check (push) Has been skipped
CI / Fuzz Testing (push) Has been skipped
CI / SBOM Generation (push) Has been skipped
CI / Security Scan (push) Successful in 33s
CI / Security Tests (push) Has been skipped
CI / Advanced Security Tests (push) Has been skipped
CI / Build & Push Image (push) Has been skipped
CI / Harbor Vulnerability Scan (push) Has been skipped
Some checks failed
CI / Lint & Format (push) Failing after 30s
CI / Unit Tests (push) Has been skipped
CI / Memory Leak Check (push) Has been skipped
CI / Fuzz Testing (push) Has been skipped
CI / SBOM Generation (push) Has been skipped
CI / Security Scan (push) Successful in 33s
CI / Security Tests (push) Has been skipped
CI / Advanced Security Tests (push) Has been skipped
CI / Build & Push Image (push) Has been skipped
CI / Harbor Vulnerability Scan (push) Has been skipped
This commit is contained in:
@@ -575,15 +575,11 @@ def validate_target_url(url: str) -> Response | None:
|
||||
"""Validate target URL for shortening. Returns error response or None if valid."""
|
||||
max_length = current_app.config["SHORT_URL_MAX_LENGTH"]
|
||||
if len(url) > max_length:
|
||||
return error_response(
|
||||
"URL too long", 400, max_length=max_length, length=len(url)
|
||||
)
|
||||
return error_response("URL too long", 400, max_length=max_length, length=len(url))
|
||||
|
||||
parsed = urlparse(url)
|
||||
if parsed.scheme not in ALLOWED_URL_SCHEMES:
|
||||
return error_response(
|
||||
"Invalid URL scheme", 400, allowed=list(ALLOWED_URL_SCHEMES)
|
||||
)
|
||||
return error_response("Invalid URL scheme", 400, allowed=list(ALLOWED_URL_SCHEMES))
|
||||
if not parsed.netloc:
|
||||
return error_response("Invalid URL: missing host", 400)
|
||||
|
||||
@@ -2233,13 +2229,15 @@ class ShortURLsListView(MethodView):
|
||||
entry["expires_at"] = row["expires_at"]
|
||||
urls.append(entry)
|
||||
|
||||
return json_response({
|
||||
"urls": urls,
|
||||
"count": len(urls),
|
||||
"total": total,
|
||||
"limit": limit,
|
||||
"offset": offset,
|
||||
})
|
||||
return json_response(
|
||||
{
|
||||
"urls": urls,
|
||||
"count": len(urls),
|
||||
"total": total,
|
||||
"limit": limit,
|
||||
"offset": offset,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user