Closed huynguyen93 closed 1 year ago
I have a custom DirectoryNamerInterface
class UserFileDirectoryNamer implements DirectoryNamerInterface { public function directoryName($object, PropertyMapping $mapping): string { return '0'; } }
The files are uploaded to correct folder (/uploads/0/file.txt), but when I get the uri, it's wrong (/uploads/file.txt)
Make a DirectoryNamer as above
the uri should be correct (/uploads/0/file.txt)
I took a look at AbstractStorage, the bug is probably caused by this check $path = !empty($dir) ? $dir.'/'.$filename : $filename;
AbstractStorage
$path = !empty($dir) ? $dir.'/'.$filename : $filename;
!empty('0') returns false;
!empty('0')
false
Duplicate of #1111
Bug Report
Summary
I have a custom DirectoryNamerInterface
The files are uploaded to correct folder (/uploads/0/file.txt), but when I get the uri, it's wrong (/uploads/file.txt)
How to reproduce
Make a DirectoryNamer as above
Expected behavior
the uri should be correct (/uploads/0/file.txt)
I took a look at
AbstractStorage
, the bug is probably caused by this check$path = !empty($dir) ? $dir.'/'.$filename : $filename;
!empty('0')
returnsfalse
;