server/tags: prevent creation of "." and ".." tags

cf. #521
Previously this check was only done on the client. The API operates on
tag slugs, and these special strings cause issues with web servers.
This commit is contained in:
Eva
2025-03-27 14:47:18 +01:00
parent 782f069031
commit 50c003f80b

View File

@ -42,6 +42,8 @@ def _verify_name_validity(name: str) -> None:
name_regex = config.config["tag_name_regex"]
if not re.match(name_regex, name):
raise InvalidTagNameError("Name must satisfy regex %r." % name_regex)
if name in [".", ".."]:
raise InvalidTagNameError(f"Tag `{name}` is not allowed.")
def _get_names(tag: model.Tag) -> List[str]: