rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 1.99k forks source link

Gem metadata URLs don't support subdomains with underscore #7528

Closed wintersolutions closed 4 years ago

wintersolutions commented 4 years ago

A metadata URL with subdomain in *.gemspec is considered invalid by bundler:

spec.metadata = {'documentation_uri' => 'https://example_workspace.gitlab.io/my_example' }

is rejected with:

The gemspec at ~/projects/my_example.gemspec is not valid. Please fix this gemspec. (Gem::InvalidSpecificationException)
The validation error was 'metadata['documentation_uri'] has invalid link: "https://example_workspace.gitlab.io/my_example"'

A slightly different subdomain like example-workspace would be accepted by the regex:

%r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}

I therefore propose to change the validation regex into:

%r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-\_]+(\.[A-Za-z\d\-\_]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}

To allow for underscores in subdomains/domains.

wintersolutions commented 4 years ago

Wrong project. Moved to https://github.com/rubygems/rubygems/issues/3061