From 47bac485ec043faa65ed63d9107b6af07a319645 Mon Sep 17 00:00:00 2001 From: Alejandro Sanchez Date: Mon, 2 Dec 2024 14:45:42 -0500 Subject: [PATCH] Update models.py --- breathecode/registry/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/breathecode/registry/models.py b/breathecode/registry/models.py index 92a960d47..1e701c91f 100644 --- a/breathecode/registry/models.py +++ b/breathecode/registry/models.py @@ -922,7 +922,11 @@ def compare_versions(version1, version2): return 0 - original_version = branch_name + pattern = r"^v\d+\.\d+$" + if not bool(re.match(branch_name, string)): + raise ValueError("Version name must follow the format vX.X, for example: v1.0") + + original_version = branch_name.replace("v", "") original_major_version = int(original_version.split(".")[0]) assets = Asset.objects.filter(readme_url__icontains=f"github.com/{org_name}/{repo_name}/blob/")