Skip to content

Commit

Permalink
Resolves #859.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Dec 5, 2024
1 parent 7818dee commit 9357ea6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions workbench
Original file line number Diff line number Diff line change
Expand Up @@ -3369,6 +3369,18 @@ def create_redirects():

redirect_row_count += 1

if len(row["redirect_source"].strip()) == 0:
message = f"Redirect source value in input CSV row {redirect_row_count} is empty. Skipping."
print("Warning: " + message)
logging.warning(message)
continue

if len(row["redirect_target"].strip()) == 0:
message = f"Redirect target value in input CSV row {redirect_row_count} is empty. Skipping."
print("Warning: " + message)
logging.warning(message)
continue

if row["redirect_source"].lower().startswith("http"):
message = (
'Redirect source values cannot contain a hostname, they must be a path only. Skipping creating redirect from "'
Expand Down
12 changes: 12 additions & 0 deletions workbench_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3109,6 +3109,18 @@ def check_input(config, args):

check_for_redirects_csv_data = get_csv_data(config)
for count, row in enumerate(check_for_redirects_csv_data, start=1):
if len(row["redirect_source"].strip()) == 0:
message = f"Redirect source value in input CSV row {count} is empty. Redirect will not be created."
logging.warning(message)
warnings_about_redirect_input_csv = True
continue

if len(row["redirect_target"].strip()) == 0:
message = f"Redirect target value in input CSV row {count} is empty. Redirect will not be created."
logging.warning(message)
warnings_about_redirect_input_csv = True
continue

if row["redirect_source"].lower().startswith("http"):
message = (
'Redirect source values cannot contain a hostname, they must be a path only, without a hostname. Please correct "'
Expand Down

0 comments on commit 9357ea6

Please sign in to comment.