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

700 permission in subfolder using 'path' #589

Open
pawel-sz opened this issue Oct 11, 2022 · 2 comments
Open

700 permission in subfolder using 'path' #589

pawel-sz opened this issue Oct 11, 2022 · 2 comments

Comments

@pawel-sz
Copy link

pawel-sz commented Oct 11, 2022

It creates files, but created dir 'filename_dir' has only 700 permissions

`        $this->addBehavior('Josegonzalez/Upload.Upload', [
            'image' => [
                'keepFilesOnDelete' => false,
                'transformer' => function ($table, $entity, $data, $field, $settings, $filename) {
                    $this->patchEntity($entity, [
                        'filename' => $filename,
                    ]);
                    return [
                        $data->getStream()->getMetadata('uri') => $filename,
                    ];
                },
                'path' => 'webroot{DS}images{DS}{field-value:filename_dir}{DS}',
                'deleteCallback' => function (string $path, Image $entity) {
                    return [
                        $path . $entity->filename,
                    ];
                },
            ]
        ]);`

1

for example. this 6117de6f-dee3-4d1c-b38b-ceee9a8f8534 folder has 700 permission
2

@pawel-sz pawel-sz changed the title 700 permissions in subfolder using 'path' 700 permission in subfolder using 'path' Oct 11, 2022
@pawel-sz
Copy link
Author

pawel-sz commented Oct 12, 2022

/vendor/josegonzalez/cakephp-upload/src/File/Writer/DefaultWriter.php linie 185, this change fix problem:

        if ($adapter instanceof FilesystemAdapter) {
            return new Filesystem($adapter, Hash::get($settings, 'filesystem.options', [
                'visibility' => Visibility::PUBLIC,
                'directory_visibility' => Visibility::PUBLIC,  //this line fix issue
            ]));
        }

@hareshpatel1990
Copy link

hareshpatel1990 commented Oct 24, 2024

@pawel-sz you have save my day. Thanks

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