Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flysystem-webdav - WebDAVAdapter.php - createDirectory() not working allways #1689

Open
chris5560 opened this issue Jul 30, 2023 · 1 comment

Comments

@chris5560
Copy link

In "WebDAVAdapter.php" file, the function "createDirectory" does not work,
if a directory specified for "$path" starts with a "." or "/". The function will "return" directly.
Line 219 says "return" it must be "continue" and everything works fine.
Please fix it.
Thanks Christian

@tinect
Copy link
Contributor

tinect commented Dec 27, 2023

This would not only affect WebDAV, but at least also InMemory, StaticInMemory and ZipArchive.

Example test:

/**
 * @test
 *
 * @dataProvider directoryPrefixProvider
 */
public function ensure_prefixed_directories_are_created_issue_1689(string $path): void
{
    $this->runScenario(function () use ($path) {
        $adapter = $this->adapter();

        $adapter->createDirectory(
            $path.'test',
            new Config()
        );

        $this->assertTrue($adapter->directoryExists('test'));
    });
}

public static function directoryPrefixProvider(): iterable
{
    yield [ './'];
    yield [ '/'];
    yield [ '/./'];
}

And what about creating a file ./my_fily.txt. This results into errors, too.

If you think it's worth, feel free to create a PR to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants