In older versions of filefield_paths module, after fixing issue https://www.drupal.org/node/1361884 module checks file_uri_scheme for each file via:
function filefield_paths_uri_is_local($uri) {
$scheme = file_uri_scheme($uri);
$wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_LOCAL);
return !empty($wrappers[$scheme]) && empty($wrappers[$scheme]['remote']);
}
But in current version this function is replaced by other code that checks only field uri:
$wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_WRITE);
foreach ($items as &$file) {
$scheme = $field['settings']['uri_scheme'];
if (!empty($wrappers[$scheme])) {
I use mixed media field that can contains local files and youtube video (via media_youtube). Current version of filefield_paths module checks only field settings, so it broke all youtube:// urls.
Please give back old version of uri scheme checking for each file, or provide any other solution for this problem.
Comments
Comment #2
murzGood way may be replace string:
to
or this is not so good solution?
Comment #3
murzThis way fix problem on my sites, so I attach my patch, please review it.
Comment #4
decipheredNo, that is not a good solution, as a normal file is uploaded to 'temporary://' before being processed, and this change will ensure that the file stays there, breaking all file uploads.
I'll do some testing ASAP to see if I can reproduce the issue and determine an appropriate fix.
Comment #5
murzThanks for the reply, how to reproduce:
1. Install modules: FileField paths, Media, File Entity, Media Youtube
2. Create new file field with Media Browser widget
3. Setup some "File path" and "File name" templates.
4. Attach to this field some local file, and Media Youtube object
You will see that FileField paths creates empty file on target path for "Media Youtube object", and break youtube:// uri for this file.
Comment #6
murzAlso I test my patch with Media Browser widget - it works normally, because Media Browser widget already do upload process and provide public:// path to field object.
But with default file widget seems that FileField paths got temporary:// url, so here may be the problem. But after test upload I see normal path for default file widget too, seems that FileField paths check paths double time - with temporary:// and after this - with public:// path.
Comment #7
erier commentedI'm having a similar issue where the updated 'temporary://' logic is causing fits.
The logs show this:
File temporary://filefield_paths/...file_path (/server/path/...) could not be copied because it does not exist.
We've reverted the module to it's previous version and everything is back to normal.
This is one of our go-to modules for asset organization/etc. Hope this can be fixed so we can upgrade again!
Thanks
Comment #8
dobe commentedHaving same issue.
Comment #9
decipheredCan I confirm all having this issue are using the Media Browser / Media Youtube?
Comment #11
decipheredOk, so in regards to the Youtube issue.... the module is taking a bit of a liberty in using a File field where it isn't actually storing a file in the system, and as such it's partially to blame for this behaviour. File (Field) Paths would be perfectly fine with it using the 'youtube://' file stream wrapper if the said stream wrapper was actually present... but it's not in this case.
As such, I have implemented a workaround similar to the above suggested, but in a way that respects the normal functionality of this module as well. Now it will check if the current (unprocessed) file lives in the 'temporary' or destination file stream wrapper before trying to process the file.
For anyone in this issue having problems with temporary:// but not in relation to Media Youtube, please provide details in #2582799: File Field Path save only to Temporary Directory
Comment #14
deciphered