-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata Pathing bug when using ud_get_stateless_media()->add_media( false, id ); #343
Comments
I'm wondering if I shouldn't be passing in "false" for the $metadata parameter as it gets used to generate the fileLink here: https://github.com/wpCloud/wp-stateless/blob/88a38db18ae69d7b5d2ec3a57df4a3ea468d2029/lib/classes/class-utility.php#L236 No, that's not it. Perhaps $file is getting unexpected output because I'm running roots bedrock? |
$upload_dir[ 'basedir' ] gives this:
basedir is a symlink: But when I execute this script in the environment, all seems as it should be: <?php
$file = '';
$upload_dir = wp_upload_dir();
var_dump($upload_dir);
$attachment_id = 73;
$force=false;
$fullsizepath = wp_normalize_path( get_attached_file( $attachment_id ) );
var_dump($fullsizepath);
$file = str_replace( wp_normalize_path(trailingslashit( $upload_dir[ 'basedir' ] )), '', $fullsizepath );
var_dump($file); array(6) { |
I was going to start updating plugin versions incrementally, but upon updating from 2.1.5 to 2.1.6 this behavior showed up again. |
2.1.5 on the left, 2.1.6 on the right: https://github.com/wpCloud/wp-stateless/blob/2.1.5/lib/classes/class-utility.php#L241 Running tests on these: string(86) "/chroot/home/demo/obfuscation.com/docroot/web/app/uploads/the-carlisle.png" 2.1.5: string(0) "" php > echo dirname("the-carlisle.png"); The end result is that all image sizes get uploaded to the "./" directory in GCS while the default image does not. Is this expected behavior? |
I've tried this on a few other dev sites, some legacy, others running roots/bedrock. The problem only occurs on Bedrock-based sites and may have something to do with how it moves the uploads directory around. https://github.com/roots/bedrock May not be a bedrock thing as it could simply be that the Wordpress option to stop storing files in year/month directories results in assets in uploads. And then
|
I'm programmatically doing the following via Ansible as part of a site migration playbook but some of the images are being uploaded to the wrong GCS bucket folder.
Some of the assets were uploaded correctly, while a large portion were uploaded to the GCS bucket and placed in a folder named "./" which is inaccessible except by using
gsutil
commands. Somehow the pathing in the metadata is off: "./demo-dev-assets/uploads/----->./<------"Here's the serialized data below from one of the assets.
The text was updated successfully, but these errors were encountered: