You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2018/01/03 17:41:27 UTC

[maven-site-plugin] 14/30: [MSITE-600] merge r1175226 from trunk

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-site-plugin-2.4
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git

commit 39d1ddb68cc62dd3d5cb476d4b3aed0ffd9c0321
Author: Lukas Theussl <lt...@apache.org>
AuthorDate: Tue Sep 27 07:16:14 2011 +0000

    [MSITE-600] merge r1175226 from trunk
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/branches/maven-site-plugin-2.x@1176241 13f79535-47bb-0310-9956-ffa450edef68
---
 .../maven/plugins/site/AbstractDeployMojo.java     | 32 ++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java b/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
index af62eaa..728d77b 100644
--- a/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
@@ -677,8 +677,8 @@ public abstract class AbstractDeployMojo
             }
 
             // MSITE-600
-            URIPathDescriptor siteURI = new URIPathDescriptor( site.getUrl(), "" );
-            URIPathDescriptor oldSiteURI = new URIPathDescriptor( oldSite.getUrl(), "" );
+            URIPathDescriptor siteURI = new URIPathDescriptor( URIEncoder.encodeURI( site.getUrl() ), "" );
+            URIPathDescriptor oldSiteURI = new URIPathDescriptor( URIEncoder.encodeURI( oldSite.getUrl() ), "" );
 
             if ( !siteURI.sameSite( oldSiteURI.getBaseURI() ) )
             {
@@ -688,4 +688,32 @@ public abstract class AbstractDeployMojo
 
         return site;
     }
+
+    private static class URIEncoder
+    {
+        private static final String mark = "-_.!~*'()";
+        private static final String reserved = ";/?:@&=+$,";
+
+        public static String encodeURI( final String uriString )
+        {
+            final char[] chars = uriString.toCharArray();
+            final StringBuilder uri = new StringBuilder( chars.length );
+
+            for ( int i = 0; i < chars.length; i++ )
+            {
+                final char c = chars[i];
+                if ( ( c >= '0' && c <= '9' ) || ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' )
+                        || mark.indexOf( c ) != -1  || reserved.indexOf( c ) != -1 )
+                {
+                    uri.append( c );
+                }
+                else
+                {
+                    uri.append( '%' );
+                    uri.append( Integer.toHexString( (int) c ) );
+                }
+            }
+            return uri.toString();
+        }
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.