diff --git a/src/azure_dfs_filesystem.cpp b/src/azure_dfs_filesystem.cpp index ac977af..1e7ec83 100644 --- a/src/azure_dfs_filesystem.cpp +++ b/src/azure_dfs_filesystem.cpp @@ -163,8 +163,15 @@ unique_ptr AzureDfsStorageFileSystem::CreateHandle(const OpenFi auto storage_context = GetOrCreateStorageContext(opener, info.path, parsed_url); auto file_system_client = storage_context->As().GetDfsFileSystemClient(parsed_url.container); + // A trailing '/' is only a directory hint, not part of the resource name. Some DFS endpoints (e.g. OneLake) + // reject a GetProperties on a trailing-slash path with 403 AuthenticationFailed, so strip it for the client. + auto file_path = parsed_url.path; + if (file_path.size() > 1 && file_path.back() == '/') { + file_path.pop_back(); + } + auto handle = make_uniq(*this, info, flags, storage_context->options, - file_system_client.GetFileClient(parsed_url.path)); + file_system_client.GetFileClient(file_path)); if (!handle->PostConstruct()) { return nullptr; }