You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Mike Summers (JIRA)" <ji...@apache.org> on 2016/08/15 20:48:21 UTC

[jira] [Comment Edited] (WAGON-461) URL string not properly encoded by webdav

    [ https://issues.apache.org/jira/browse/WAGON-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15421645#comment-15421645 ] 

Mike Summers edited comment on WAGON-461 at 8/15/16 8:47 PM:
-------------------------------------------------------------

We seem to be having a communication problem.

The webdav string comes from a pom:
{code:xml}
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
               <execution>
                  <id>upload-assembly</id>
                  <phase>install</phase>
                  <goals>
                     <goal>upload-single</goal>
                  </goals>
                  <configuration>
                     <serverId>sharefile-ftp</serverId>
                     <fromFile>${project.build.directory}/${project.build.finalName}.jar</fromFile>
                     <!--
                        <url>ftp://snafu.sharefileftp.com/FIT - Expert Services/IBM/</url>
                     -->
                     <url>dav:https://snafu.sharefile-webdav.com/Shared Folders/Fit - Expert Services/IBM</url>
                  </configuration>
               </execution>
            </executions>
         </plugin>
{code}

It _is_ a valid webdav URI, it is simply not encoded properly by wagon-webdav. Adding the one line of code to encode the URI fixes the problem. Hand encoding the URI in the POM does not fix the problem.

Using wagon-ftp rather than wagon-webdav also works
{code:xml}
 <url>ftp://snafu.sharefileftp.com/FIT - Expert Services/IBM/</url>
{code}
which seems to indicate the the encoding is not a plugin function.

_Is_ it the plugins job to encode the URI?



was (Author: msummers):
We seem to be having a communication problem.

The webdav string comes from a pom:
{code:xml}
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
               <execution>
                  <id>upload-assembly</id>
                  <phase>install</phase>
                  <goals>
                     <goal>upload-single</goal>
                  </goals>
                  <configuration>
                     <serverId>sharefile-ftp</serverId>
                     <fromFile>${project.build.directory}/${project.build.finalName}.jar</fromFile>
                     <!--
                        <url>ftp://newrelic.sharefileftp.com/FIT - Expert Services/IBM/</url>
                     -->
                     <url>dav:https://snafu.sharefile-webdav.com/Shared Folders/Fit - Expert Services/IBM</url>
                  </configuration>
               </execution>
            </executions>
         </plugin>
{code}

It _is_ a valid webdav URI, it is simply not encoded properly by wagon-webdav. Adding the one line of code to encode the URI fixes the problem. Hand encoding the URI in the POM does not fix the problem.

Using wagon-ftp rather than wagon-webdav also works
{code:xml}
 <url>ftp://snafu.sharefileftp.com/FIT - Expert Services/IBM/</url>
{code}
which seems to indicate the the encoding is not a plugin function.

_Is_ it the plugins job to encode the URI?


> URL string not properly encoded by webdav
> -----------------------------------------
>
>                 Key: WAGON-461
>                 URL: https://issues.apache.org/jira/browse/WAGON-461
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-webdav
>    Affects Versions: 2.10
>         Environment: All
>            Reporter: Mike Summers
>
> wagon-webdav is not calling EncodingUtil prior to instantiating MkColMethod which results in
> {code:java}
> Caused by: java.lang.IllegalArgumentException: Invalid uri 'https://snafu.sharefile-webdav.com/Shared Folders/Fit - Expert Services/IBM/': escaped absolute path not valid
> {code}
> when there are special characters in the URI string.
> Changing line 153 of org.apache.maven.wagon.providers.webdav.WebDavWagon from
> {code:java}
>             method = new MkColMethod( url );
> {code}
> to
> {code:java}
>             method = new MkColMethod( EncodingUtil.encodeURLToString( url ) );
> {code}
> solves the issue although you may want to fix it elsewhere in the flow.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)