PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
← All changes | includes/integrations/imagify/imagify.php +11 -2 1.3.121.4.1 View file →
@@ -71,9 +71,9 @@
71 71
72 72 /**
73 73 * Copy file from cloud storage before optimization when it is missing locally.
74 74 *
75 - * Mirrors Imagify's official AS3CF integration hook handler.
75 + * Mirrors Imagify's official offload-plugin integration hook handler.
76 76 *
77 77 * @param null|\WP_Error $response The response.
78 78 * @param object $process The optimization process instance.
79 79 * @param object $file The Imagify file instance.
@@ -179,10 +179,11 @@
179 179 }
180 180 }
181 181
182 182 if ( $files_to_upload ) {
183 + $is_private = !empty( $new_item['is_private'] );
183 184 foreach ( $files_to_upload as $relative_source_path => $path ) {
184 - $uploaded = Service::instance()->uploadSingle( $path, $relative_source_path, $prefix );
185 + $uploaded = Service::instance()->uploadSingle( $path, $relative_source_path, $prefix, $is_private );
185 186 if ( $uploaded['success'] ) {
186 187 $files_to_remove[] = $path;
187 188 }
188 189 }
@@ -504,8 +505,16 @@
504 505 if ( ! $file_name ) {
505 506 $url = Item::instance()->get_url( $attachment_id, 'full', 'media_library' );
506 507
507 508 return $url ? $url : (string) wp_get_attachment_url( $attachment_id );
509 + }
510 +
511 + // Splicing $file_name onto the full URL's directory only works for a plain public
512 + // URL — the full URL is a presigned request when the item is private, and its
513 + // signature is tied to that exact key. Fail closed rather than hand back a URL
514 + // that looks valid but isn't (garbled signature, or unsigned and unreadable).
515 + if ( Item::instance()->get_field( $attachment_id, 'is_private', 'media_library' ) ) {
516 + return '';
508 517 }
509 518
510 519 $filesystem = \Imagify_Filesystem::get_instance();
511 520 $full_url = $this->get_provider_file_url( $attachment_id );