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

gurwls223 pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.5 by this push:
     new bda0545e785 [SPARK-44348][CONNECT][FOLLOW-UP] Avoid double slashes in 
the URI
bda0545e785 is described below

commit bda0545e785b2c15db57b07b2b72b3a164d8a929
Author: Hyukjin Kwon <gurwls...@apache.org>
AuthorDate: Tue Jul 18 14:50:21 2023 +0900

    [SPARK-44348][CONNECT][FOLLOW-UP] Avoid double slashes in the URI
    
    ### What changes were proposed in this pull request?
    
    This PR is a followup of https://github.com/apache/spark/pull/41942 that 
does `substring(1)` to remove the leading slash so it makes it relative parts 
from URI. Otherwise, it can end up with having double slashes in the middle.
    
    ### Why are the changes needed?
    
    To avoid having unnecessary double slashes  ... and save one byte :-)
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Manually tested. It's really trivial.
    
    Closes #42051 from HyukjinKwon/minor-change.
    
    Authored-by: Hyukjin Kwon <gurwls...@apache.org>
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
---
 core/src/main/scala/org/apache/spark/util/Utils.scala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala 
b/core/src/main/scala/org/apache/spark/util/Utils.scala
index eafb4443662..048c6ebfa74 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -442,7 +442,7 @@ private[spark] object Utils extends Logging with 
SparkClassUtils {
     // `file` and `localhost` are not used. Just to prevent URI from parsing 
`fileName` as
     // scheme or host. The prefix "/" is required because URI doesn't accept a 
relative path.
     // We should remove it after we get the raw path.
-    encodeRelativeUnixPathToURIRawPath(fileName).substring(1)
+    encodeRelativeUnixPathToURIRawPath(fileName)
   }
 
   /**
@@ -453,7 +453,7 @@ private[spark] object Utils extends Logging with 
SparkClassUtils {
     // `file` and `localhost` are not used. Just to prevent URI from parsing 
`fileName` as
     // scheme or host. The prefix "/" is required because URI doesn't accept a 
relative path.
     // We should remove it after we get the raw path.
-    new URI("file", null, "localhost", -1, "/" + path, null, null).getRawPath
+    new URI("file", null, "localhost", -1, "/" + path, null, 
null).getRawPath.substring(1)
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to