artifactory-client-java icon indicating copy to clipboard operation
artifactory-client-java copied to clipboard

Issue with Spaces in Description

Open darewreck54 opened this issue 5 years ago • 1 comments

Hi,

When I try to upload an artifact with a property description with spaces, it throws an URI exception.

` Artifactory artifactory;

 artifactory.repository(<repo>)
            .upload(<Path>, <tarfileName>).toString(),
                Channels.newInputStream(<tarFileBlob>.reader()))
            .withProperty("npm.name", <name>)
            .withProperty("npm.version",<version>)
            .withProperty("npm.keywords",<keywords>)
            .withProperty("npm.description", "Test Test Lib">)
            .withProperty("artifactory.licenses", <licenses>);

`

I get the following exception thrown because of the spaces in the description.

https://<organization>.jfrog.io/<organization>/<repo>/<name>/<version>/<tar>;npm.version=<version>;artifactory.licenses=<license>;npm.description=Test Test Lib;npm.name=<name>;npm.keywords=<keywords> at java.net.URI.create(URI.java:852)

I'm using the newest tag version 2.8.5.

Are we expected to encode the values passed into withProperty?

Thanks, Derek

darewreck54 avatar Sep 29 '19 04:09 darewreck54

Looks like if i go

.withProperty("npm.description", URLEncoder.encode("Test Test Lib", StandardCharsets.UTF_8.toString()))

it works.

Is this stated in the documentation? I couldn't find it. Wouldn't it be better to just encode it vs. relying on the caller to do it?

darewreck54 avatar Sep 29 '19 06:09 darewreck54