| 3535 | } |
| 3536 | |
| 3537 | Result<std::string> AzureFileSystem::PathFromUri(const std::string& uri_string) const { |
| 3538 | /// We can not use `internal::PathFromUriHelper` here because for Azure we have to |
| 3539 | /// support different URI schemes where the authority is handled differently. |
| 3540 | /// Example (both should yield the same path `container/some/path`): |
| 3541 | /// - (1) abfss://storageacc.blob.core.windows.net/container/some/path |
| 3542 | /// - (2) abfss://acc:pw@container/some/path |
| 3543 | /// The authority handling is different with these two URIs. (1) requires no prepending |
| 3544 | /// of the authority to the path, while (2) requires to preprend the authority to the |
| 3545 | /// path. |
| 3546 | std::string path; |
| 3547 | Uri uri; |
| 3548 | RETURN_NOT_OK(uri.Parse(uri_string)); |
| 3549 | RETURN_NOT_OK(AzureOptions::FromUri(uri, &path)); |
| 3550 | |
| 3551 | std::vector<std::string> supported_schemes = {"abfs", "abfss"}; |
| 3552 | const auto scheme = uri.scheme(); |
| 3553 | if (std::find(supported_schemes.begin(), supported_schemes.end(), scheme) == |
| 3554 | supported_schemes.end()) { |
| 3555 | std::string expected_schemes = |
| 3556 | ::arrow::internal::JoinStrings(supported_schemes, ", "); |
| 3557 | return Status::Invalid("The filesystem expected a URI with one of the schemes (", |
| 3558 | expected_schemes, ") but received ", uri_string); |
| 3559 | } |
| 3560 | |
| 3561 | return path; |
| 3562 | } |
| 3563 | |
| 3564 | } // namespace arrow::fs |