700 permission in subfolder using 'path'
pawel-sz opened this issue · 2 comments
pawel-sz commented
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,
];
},
]
]);`
for example. this 6117de6f-dee3-4d1c-b38b-ceee9a8f8534 folder has 700 permission
pawel-sz commented
/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
]));
}