Skip to content

FileSystemClient.create_directory misinterprets PurePosixPath #16159

@kasuteru

Description

@kasuteru

Describe the bug
Normal Python behavior is to interpret pathlib.PurePosixPath as a string. FileSystemClient.create_directory seems to instead take the name parameter (PurePosixPath.name) and therefore always creates a top-level folder if provided a PurePosixPath. A workaround is to explicitely convert to str beforehand, but I will probably not be the last one to make that mistake, since the framework for ADLS Gen1 treated PurePosixPath as expected.

Example:

To Reproduce

from pathlib import PurePosixPath
mypath = PurePosixPath("toplevel/subfolder/newfolder")
my_file_system_client.create_directory(mypath)

Expected behavior
Create a directory named newfolder in "toplevel/subfolder", just like os.mkdir would.

Actual behavior
Creates a folder newfolder in root.

Additional context
I assume it treats the PurePosixPath as a DirectoryProperties object and takes the "name" argument.

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Data Lake Storage Gen2bugThis issue requires a change to an existing behavior in the product in order to be resolved.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

Relationships

None yet

Development

No branches or pull requests

Issue actions