Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/5447#discussion_r28315739
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -1659,9 +1659,14 @@ private[spark] object Utils extends Logging {
val windowsDrive = "([a-zA-Z])".r
/**
- * Format a Windows path such that it can be safely passed to a URI.
+ * Format a path such that it can be safely passed to a URI.
*/
- def formatWindowsPath(path: String): String = path.replace("\\", "/")
+ def formatPath(path: String, windows: Boolean): String = {
+ val formatted = path.replace(" ", "%20")
--- End diff --
@steveloughran I think the issue is that we don't start with a `File` but
with a `String` that may not be a `file:` URI. @tsudukim fragment is the bit
after `#` in a URI, such as in `file:/foo/bar#baz` There's no fragment in your
example and I would never expect to support such a thing. In fact I was a
little surprised that this constructor handled the scheme in a scheme-specific
part, but it seems to:
```
scala> val uri = new java.net.URI(null, "hdfs:/foo/b ar#baz", null)
uri: java.net.URI = hdfs:/foo/b%20ar%23baz
scala> uri.toString
res12: String = hdfs:/foo/b%20ar%23baz
scala> uri.getScheme
res13: String = hdfs
scala> uri.getPath
res14: String = /foo/b ar#baz
scala> uri.getFragment
res15: String = null
```
This still seems like the way to go as far as I can tell.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]