diff --git a/src/bb_asset_validation/cli.py b/src/bb_asset_validation/cli.py index fce8b6a..b282b12 100644 --- a/src/bb_asset_validation/cli.py +++ b/src/bb_asset_validation/cli.py @@ -40,8 +40,13 @@ def split_path(path): return split_path def get_path_components(asset_path: str): - pattern = re.compile(r"(?P/shows/(?P\S*?)/\S*?/(?P\S*?)/(?P\S*?)_v(?P\S*?)/(?P\S*?)/\S*?/(?P\S*?)_v(?P\d*)\D*?(?P\d*)\D*?\.(?P\w*)\Z)") + regex_pattern = r"(?P/shows/(?P\S*?)/\S*?/(?P\S*?)/(?P\S*?)_v(?P\S*?)/(?P\S*?)/\S*?/(?P\S*?)_v(?P\d*)\D*?(?P\d*)\D*?\.(?P\w*)\Z)" + pattern = re.compile(regex_pattern) match = pattern.match(asset_path) + + if(not match): + raise Exception("Regex pattern matching failed. This is likely due to one of your paths using the incorrect schema.") + path_components = match.groupdict() return path_components