routes: fix ruff formatting

This commit is contained in:
Username
2026-02-16 22:02:36 +01:00
parent 727e432740
commit c484c9ecc8

View File

@@ -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,
}
)
# ─────────────────────────────────────────────────────────────────────────────