Skip to content

DataLakeDirectoryClient::ListPaths() throws exception for folders whose names contain spaces. #7475

Closed

Description

@HoraceBianchon

Describe the bug
DataLakeDirectoryClient::ListPaths() throws Azure::Storage::StorageException exception on folders whose names contain spaces.

For example, we have the code part below. Its throws Azure::Storage::StorageException exception with "404 The specified path does not exist." message, even when specified folder(which name contains space) exist.

      DataLakeDirectoryClient cleint = DataLakeDirectoryClient::CreateFromConnectionString(connectionString, containerName, folderPath, options);
      client.GetSubdirectoryClient("Test Folder/").ListPaths(includeSubfolders, ListPathsOptions{});

When we use this code part it works correct.

      DataLakeDirectoryClient cleint = DataLakeDirectoryClient::CreateFromConnectionString(connectionString, containerName, folderPath + "Test Folder/", options);
      client.ListPaths(includeSubfolders, ListPathsOptions{});

My investigation shows the root cause comes from the file ...\azure-sdk-for-cpp-azure-storage-common\sdk\storage\azure-storage-common\src\crypt.cpp and functions UrlEncodeQueryParameter().

Root cause

When we call the ListPaths it has nested call to the _internal::UrlEncodeQueryParameter to encode folder's path.
Meanwhile the GetSubdirectoryClient also has nested call to the function _internal::UrlEncodePath().
As a result, when we make a call client.GetSubdirectoryClient("Test Folder/").ListPaths(includeSubfolders, ListPathsOptions{}) the folder name "Test Folder/" encodes twice. After first encode from the GetSubdirectoryClient() the "Test Folder/" becomes "Test%20Folder/". And after second encode it becomes "Test%2520Folder/". If we decode the last string, it will be "Test%20Folder/", which is incorrect. The decoded path should be same "Test Folder/".

If we added '%' symbol to the doNotEncodeCharacters += "/:@?"; line in the function UrlEncodeQueryParameter(), it should fix the issue.

Exception or Stack Trace

Azure::Storage::StorageException with error message

404 The specified path does not exist.
The specified path does not exist.
RequestId:ec627031-101f-007a-1754-5df83a000000
Time:2026-10-16T09:55:26.3272893Z
Request ID: ec627031-101f-007a-1754-5df83a000000

Code Snippet

      DataLakeDirectoryClient cleint = DataLakeDirectoryClient::CreateFromConnectionString(connectionString, containerName, folderPath, options);
      client.GetSubdirectoryClient("Test Folder/").ListPaths(includeSubfolders, ListPathsOptions{});

Expected behavior
The folders should be visible and accessible regardless of whether the folder name contains spaces.

Setup (please complete the following information):

  • OS: [e.g. Windows]
  • IDE : [e.g. Visual Studio Professional 2022]
  • Version of the Library used: azure-core_1.16.4, azure-storage-common_12.15.0, azure-storage-files-datalake_12.17.0

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
    encodes

Activity

  1. added
    ClientThis issue points to a problem in the data-plane of the library.
    customer-reportedIssues that are reported by GitHub users external to the Azure organization.
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    Service AttentionWorkflow: This issue is responsible by Azure service team.
    StorageStorage Service (Queues, Blobs, Files)
    on Oct 16, 2026
  2. github-actions commented on Oct 16, 2026

    @github-actions

    Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc Amanda Nguyen (@amnguye) Gauri Lamunion (@gapra-msft) JinmingHu (@Jinming-Hu).

  3. Jinming-Hu commented on Oct 17, 2026

    @Jinming-Hu
    Member

    I tried this against a live ADLS Gen2 account using the current SDK source (12.18.0-beta.1), but couldn't reproduce the 404.

    I created parent/Test Folder with a file inside it, then called GetSubdirectoryClient("Test Folder") on the parent client and ListPaths(false) on the returned client. The file was listed correctly. I also tried GetSubdirectoryClient("Test Folder/"), with the trailing slash from your example, and that worked too.

    The outgoing request had directory=parent/Test%20Folder, so I didn't see double encoding. I used OAuth authentication and service API version 2025-05-05, rather than an account-key connection string, so the setup wasn't identical to yours.

    Could you try again with the latest published SDK version and let us know whether it still happens? If it does, please share a small complete repro and the package versions you're using, with credentials removed.

  4. HoraceBianchon commented on Oct 19, 2026

    @HoraceBianchon
    Author

    Thanks for the request. I have checked it works in the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.StorageStorage Service (Queues, Blobs, Files)customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions