RiotGamesMinions / nexus_cli

A CLI wrapper and library for interacting with Sonatype's Nexus
Other
69 stars 45 forks source link

downcase breaks case sensitive repo requests #99

Closed blakewhite closed 8 years ago

blakewhite commented 10 years ago

We use case sensitive repo names. The following code makes those somewhat problematic to use with this gem.

    attribute :repository,
      type: String,
      required: true,
      coerce: lambda { |m|
        m = m.is_a?(String) ? m.gsub(' ', '_').downcase : m
      }

and possibly:

    # Transforms a given [String] into a sanitized version by
    # replacing spaces with underscores and downcasing.
    # 
    # @param  unsanitized_string [String] the String to sanitize
    # 
    # @return [String] the sanitized String
    def sanitize_for_id(unsanitized_string)
      unsanitized_string.gsub(" ", "_").downcase
    end

The result is requests that look like:

/nexus/service/local/artifact/maven/resolve?g=com.company.project.product&a=ArtifactName&e=jar&v=1.0.15&r=repo-name

which should look like:

/nexus/service/local/artifact/maven/resolve?g=com.company.project.product&a=ArtifactName&e=jar&v=1.0.15&r=Repo-Name
KAllan357 commented 10 years ago

Thanks for this. I never realized that case matter, and I agree - we should remove the downcase. I think the original implementation was that we wanted to attempt to sanitize your config file a bit.

Maybe we should be less prescriptive here and just sanitize it into a valid, acceptable Maven repo name.

crackmac commented 9 years ago

+1

I've added PR #108.

pyro2927 commented 8 years ago

Fixed with #108