Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix name regex to be truly 50 characters only. #2923

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

douppc
Copy link

@douppc douppc commented Jan 26, 2023

Abstract

The previous text of this help documentation provides a regex that actually allows a name of size 51 characters instead of what the rest of documentation claims is 50 characters. This new regex checks that it is appropriately 50 characters.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -11,7 +11,7 @@ Attributes
name
----
This is a string, with a minimum of 2 and a maximum of 50 characters (though shorter names are recommended), that defines the package name. It will be the ``<pkgName>/version@user/channel`` of the package reference.
It should match the following regex ``^[a-zA-Z0-9_][a-zA-Z0-9_\+\.-]{1,50}$``, so start with alphanumeric or underscore, then alphanumeric, underscore, +, ., - characters.
It should match the following regex ``^[a-zA-Z0-9_][a-zA-Z0-9_\+\.-]{1,49}$``, so start with alphanumeric or underscore, then alphanumeric, underscore, +, ., - characters.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @douppc
Thanks for contributing this. The actual code is:

 _max_chars = 51
    _min_chars = 2
    _validation_pattern = re.compile("^[a-zA-Z0-9_][a-zA-Z0-9_\+\.-]{%s,%s}$"
                                     % (_min_chars - 1, _max_chars - 1))

    _validation_revision_pattern = re.compile("^[a-zA-Z0-9]{1,%s}$" % _max_chars)

So the regex is correct. However I don't think it is worth arguing over this, Conan 2.0 is almost there, and it relax a bit this assumption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants