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 eafb44436620..048c6ebfa748 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) } /**