- Issue created by @berdir
- last update
almost 2 years ago 21 pass - Status changed to Closed: duplicate
about 1 year ago 7:28pm 14 May 2024
The function checks that the current stream wrapper of a given file entity is either the temporary or the destination stream wrapper, and if not, it doesn't touch the file.
That makes perfect sense and is exactly what I need in my project. The problem is that the current way of getting the source and temporary stream wrapper is wrong.
I thought this might have been due to the deprecation of related functions in D9/10, but that's not the case. It's been like this since 2015.
What the code does is get a stream wrapper for the given URI, then get its type, which is a description of its features using bitwise constants, and pick the first one of the returned wrappers that has this feature. Because the type works as it does, if you have a read-only remote wrapper that is only implementing READ, then getWrappers() will return pretty much anything, because public for example is also readable. And then it picks public and is happy and proceeds.
Use \Drupal\Core\StreamWrapper\StreamWrapperManager::getScheme() to get the scheme directly from the URI
Closed: duplicate
1.0
Code