- Issue created by @jez300
- Status changed to Postponed: needs info
9 months ago 7:57pm 15 February 2024 Drupal 9 is end-of-life and is not accepting bug reports. Please test for the bug on a supported release.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Should this issue be against views data export
The module writing the files is responsible for creating the folders
- Status changed to Active
9 months ago 9:04pm 15 February 2024 That was quick. Thank you for the replies.
larowlan: Thanks for suggesting a fix might be needed in Views data export. That module brought to light the problem creating subdirs, but the fix needed to be in Drupal core.
cilefen: Druapl 9 at end of life: Thanks. I built a patch for my drupal 9 version and will share. I also checked Drupal 10, the issues is still there, I would like to suggest adding a fix to one line in the core which is:
web/core/lib/Drupal/Core/File/FileSystem.php in function prepareDestination
Instead of calling prepareDirectory with 1 parameter, it should have 2, just like it's used in many other places from within Drupal, like this:
$this->prepareDirectory($dirname, self::CREATE_DIRECTORY | self::MODIFY_PERMISSIONS)
or at least like this:
$this->prepareDirectory($dirname, self::CREATE_DIRECTORY)
Thanks
That function doesnβt say it creates directories in its documentation.
- π¨π³China skyredwang Shanghai
I ran into the problem, and looked into the code.
Drupal Core has no problem. views_data_export module also correctly prepared the folder with subfolders on this line
$fileSystem = \Drupal::service('file_system'); $fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY); $destination = $directory . $filename;
The actual problem, at least in my case, was that my filename contains a date, which contains the slash
/
, which tricks Drupal core to think there are more subfolders.I repurposed this issue that for this module, it can escape the slash in the filename, which can help users to get around this problem.