Skip to content

Commit 1cb3cb9

Browse files
committed
fix: validate secondary_link URL when value is present
The URL validation loop skipped secondary_link entirely due to an overly broad exclusion (`field != "secondary_link"`). This meant a secondary_link containing spaces or missing the https:// scheme would pass validation silently. Change the condition so that empty optional fields are skipped (via `continue`), but non-empty values are always validated regardless of which field they belong to. The required-field check earlier in the function already ensures primary_link and author_link are present.
1 parent 56d5afd commit 1cb3cb9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/resources/parse_issue_form.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,12 @@ def validate_parsed_data(data: dict[str, str]) -> tuple[bool, list[str], list[st
173173
url_fields = ["primary_link", "secondary_link", "author_link"]
174174
for field in url_fields:
175175
value = data.get(field, "").strip()
176-
if value and field != "secondary_link": # secondary is optional
177-
if not value.startswith("https://"):
178-
errors.append(f"{field} must start with https://")
179-
elif " " in value:
180-
errors.append(f"{field} contains spaces")
176+
if not value:
177+
continue # required-field check above handles primary_link/author_link
178+
if not value.startswith("https://"):
179+
errors.append(f"{field} must start with https://")
180+
elif " " in value:
181+
errors.append(f"{field} contains spaces")
181182

182183
# Validate license
183184
if data.get("license") == "No License / Not Specified":

0 commit comments

Comments
 (0)