Jelajahi Sumber

HDFS-6141. WebHdfsFileSystem#toUrl does not perform character escaping. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1588578 13f79535-47bb-0310-9956-ffa450edef68
Chris Nauroth 11 tahun lalu
induk
melakukan
4c0fd58bbc

+ 3 - 0
CHANGES.txt

@@ -208,6 +208,9 @@ Release 1.3.0 - unreleased
     MAPREDUCE-5822. FairScheduler does not preempt due to fairshare-starvation
     when fairshare is 1. (Anubhav Dhoot via kasha)
 
+    HDFS-6141. WebHdfsFileSystem#toUrl does not perform character escaping.
+    (cnauroth)
+
 Release 1.2.2 - unreleased
 
   INCOMPATIBLE CHANGES

+ 1 - 1
src/hdfs/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java

@@ -373,7 +373,7 @@ public class WebHdfsFileSystem extends FileSystem
       final Param<?,?>... parameters) throws IOException {
     //initialize URI path and query
     final String path = PATH_PREFIX
-        + (fspath == null? "/": makeQualified(fspath).toUri().getPath());
+        + (fspath == null? "/": makeQualified(fspath).toUri().getRawPath());
     final String query = op.toQueryString()
         + '&' + new UserParam(ugi)
         + Param.toSortedString("&", parameters);

+ 1 - 1
src/test/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java

@@ -383,7 +383,7 @@ public class TestWebHdfsFileSystemContract extends FileSystemContractBaseTest {
 
     {//test create with path containing spaces
       HttpOpParam.Op op = PutOpParam.Op.CREATE;
-      Path path = new Path("/test/path%20with%20spaces");
+      Path path = new Path("/test/path with spaces");
       URL url = webhdfs.toUrl(op, path);
       HttpURLConnection conn = (HttpURLConnection)url.openConnection();
       conn.setRequestMethod(op.getType().toString());