file_unmanaged_prepare() does not work with some types of stream wrapper source URIs

Created on 19 January 2017, over 7 years ago
Updated 15 July 2024, about 2 months ago

The documentation for file_unmanaged_prepare() claims that the $source parameter is "A string specifying the filepath or URI of the source file."

Unfortunately, the first thing it does is call file_exists($source) which only accepts a path as input. So a URI fails that check.

I ran into this when trying to use file_unmanaged_copy() which calls this function.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
File systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States azinck

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.

  • πŸ‡¦πŸ‡ΊAustralia kim.pepper πŸ„β€β™‚οΈπŸ‡¦πŸ‡ΊSydney, Australia

    The first step should be to update the documentation to clarify the URI only supports a local streamwrapper. We can then create a follow up to discuss adding remote streams.

  • πŸ‡¦πŸ‡ΊAustralia kim.pepper πŸ„β€β™‚οΈπŸ‡¦πŸ‡ΊSydney, Australia

    Also file_unmanaged_prepare() was deprecated in drupal 8.7.0 and replaced with \Drupal\Core\File\FileSystem::prepareDestination() so we need an IS update.

Production build 0.71.5 2024