pitrou commented on code in PR #14974:
URL: https://github.com/apache/arrow/pull/14974#discussion_r1060728451
##########
cpp/src/arrow/util/uri.cc:
##########
@@ -306,14 +311,29 @@ Status Uri::Parse(const std::string& uri_string) {
return Status::OK();
}
-std::string UriFromAbsolutePath(const std::string& path) {
+Result<std::string> UriFromAbsolutePath(const std::string_view& path) {
+ if (path.empty()) {
+ return Status::Invalid(
+ "UriFromAbsolutePath expected an absolute path, got an empty string");
+ }
+ std::string out;
#ifdef _WIN32
- // Path is supposed to start with "X:/..."
- return "file:///" + path;
+ // Turn "/" separators into "\", as Windows recognizes both but uriparser
+ // only the latter.
+ std::string fixed_path(path);
+ std::replace(fixed_path.begin(), fixed_path.end(), '/', '\\');
+ out.resize(8 + 3 * fixed_path.length() + 1);
Review Comment:
This is simply as per the `uriWindowsFilenameToUriStringA` doc:
https://uriparser.github.io/doc/api/latest/Uri_8h.html#a422dc4a2b979ad380a4dfe007e3de845
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]