From e96784821c3a23da25e37b1ea0fef6f4958310a8 Mon Sep 17 00:00:00 2001 From: Jacques Dainat Date: Tue, 26 Mar 2024 19:52:59 +0100 Subject: [PATCH] fix url validation --- .github/workflows/check_scripts/check_yaml.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check_scripts/check_yaml.py b/.github/workflows/check_scripts/check_yaml.py index 5b1d935..1d0ba26 100755 --- a/.github/workflows/check_scripts/check_yaml.py +++ b/.github/workflows/check_scripts/check_yaml.py @@ -15,7 +15,6 @@ def validate_category(d,f): def check_bibtex_file(d, f): p = pathlib.Path(f).parent.parent / 'publication' - print(p) if 'bibtex' in d and d['bibtex']: return (p / d['bibtex']).exists() return True @@ -31,12 +30,17 @@ def validate_orcid(d, f): def validate_url(d, f): regex = re.compile(r'^https?://') - try: - if re.search(regex, d['homepage']): - return False - except Exception: + if 'homepage' in d.keys(): + if d['homepage'] is not None: + if re.search(regex, d['homepage']): + return True + else: # case value do not follow specification + return False + else: # case no value provided for homepage tag + return True + else: # case no homepage tag return True - return True +