diff --git a/python/lib/dependabot/python/version.rb b/python/lib/dependabot/python/version.rb index 525be66d6cf..0290de9f0ff 100644 --- a/python/lib/dependabot/python/version.rb +++ b/python/lib/dependabot/python/version.rb @@ -16,7 +16,7 @@ class Version < Gem::Version # See https://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions VERSION_PATTERN = 'v?([1-9][0-9]*!)?[0-9]+[0-9a-zA-Z]*(?>\.[0-9a-zA-Z]+)*' \ - '(-[0-9A-Za-z-]+(\.[0-9a-zA-Z-]+)*)?' \ + '(-[0-9A-Za-z]+(\.[0-9a-zA-Z]+)*)?' \ '(\+[0-9a-zA-Z]+(\.[0-9a-zA-Z]+)*)?' ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/.freeze diff --git a/python/spec/dependabot/python/version_spec.rb b/python/spec/dependabot/python/version_spec.rb index 58ea7988514..51f2cd33db8 100644 --- a/python/spec/dependabot/python/version_spec.rb +++ b/python/spec/dependabot/python/version_spec.rb @@ -48,6 +48,11 @@ let(:version_string) { "1.0.0+abc 123" } it { is_expected.to eq(false) } end + + context "that includes two dashes" do + let(:version_string) { "v1.8.0--failed-release-attempt" } + it { is_expected.to eq(false) } + end end end