ソースを参照

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

cnauroth 11 年 前
コミット
d40a51acd4

+ 3 - 0
HDP-CHANGES.txt

@@ -32,6 +32,9 @@ comanche-branch-1 release branched from condor-branch-1 (SHA1 bb0bbd77479125307c
     HDFS-5982. Need to update snapshot manager when applying editlog for deleting
     a snapshottable directory. (Jing Zhao)
 
+    HDFS-6141. WebHdfsFileSystem#toUrl does not perform character escaping.
+    (cnauroth)
+
   Snapshot related changes
 
     Changes with Apache jira in trunk/branch-2

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

@@ -347,7 +347,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());