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

Does directory_visibility have precedence over visibility when creating a directory #1809

Open
theodson opened this issue Aug 13, 2024 · 0 comments

Comments

@theodson
Copy link

is it correct to assume directory_visibility have precedence over visibility when creating a directory

Q A
Flysystem Version 3.2.x
Adapter Name src/Local/LocalFilesystemAdapter.php
Adapter version x.y.z

The current implementation seems counter intuitive to me, e.g. consider the src/Local/LocalFilesystemAdapterTest.php

$adapter->createDirectory('public_dir_private_files', new Config(['visibility' => 'private', 'directory_visibility' => 'public']));
$this->assertDirectoryExists(static::ROOT . '/public_dir_private_files');
$this->assertFileHasPermissions(static::ROOT . '/public_dir_private_files', 0700); 

The assertion of 0700 permissions for the directory seems odd/incorrect, should this not be 0755 given we pass directory_visibility=public

I've added two commits to this branch tests_confirming_directory_visibility_behaviour

  1. the 1st commit adds more tests around file and directory permission checks adhering to the existing implementation.
  2. the 2nd commit changed the precedence of the directory_visibility over visibility in the context of $adapter->createDirectory

See diff 3.x...theodson:flysystem:tests_confirming_directory_visibility_behaviour

Ref

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

1 participant