File blob plugin fails if target directory doesn't exist

Created on 11 May 2022, over 2 years ago
Updated 1 August 2024, about 1 month ago

Problem/Motivation

The file blob plugin fails if the target directory does not yet exist.

Warning: file_put_contents(public://2022-05/joejoe-bord-WEB.png): Failed to open stream: "Drupal\Core\StreamWrapper\PublicStream::stream_open" call failed in Drupal\migrate_plus\Plugin\migrate\process\FileBlob->putFile() (regel 160 van (...)/web/modules/contrib/migrate_plus/src/Plugin/migrate/process/FileBlob.php)

Steps to reproduce

Attempt to write a file to a non-existing subdirectory of the public files directory. The directory is not automatically created as it should.

Proposed resolution

Attempt to create the directory or change its permissions before writing files.

🐛 Bug report
Status

Fixed

Version

6.0

Component

Plugins

Created by

🇧🇪Belgium DieterHolvoet Brussels

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024