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

strip() will not always behave as desired here #86

Open
tyler-jachetta opened this issue Feb 2, 2021 · 1 comment
Open

strip() will not always behave as desired here #86

tyler-jachetta opened this issue Feb 2, 2021 · 1 comment
Labels

Comments

@tyler-jachetta
Copy link
Collaborator

version = version.strip(tag_prefix)

using strip() in this case has some issues (using v as sample prefix):

  • if the version string ends with v (e.g. '1.2.3-dev'), trailing v will be stripped
  • the first argument to strip is treated as a collection (even though a non-string will raise a TypeError), and all instances of any character in the prefix will be stripped from both ends. Thus:
>>> "aaacdsa".strip('ac')
'ds'
>>> 'version-1.2.3-dev'.strip('version-')
'1.2.3-d'

Don't have tests exercising this done yet, just saw this issue and logging it for now. No known cases of error in the wild

@tyler-jachetta
Copy link
Collaborator Author

also, here:

tags = [t.strip(self.options['tag_prefix']) for t in tags]

@otakup0pe otakup0pe added the bug label Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants