| @@ -608,9 +608,9 @@ | ||
| 608 | 608 | /** |
| 609 | 609 | * Upload Single |
| 610 | 610 | * @since 1.0.0 |
| 611 | 611 | */ |
| 612 | - public function uploadSingle($absolute_source_path, $relative_source_path, $prefix='') { | |
| 612 | + public function uploadSingle($absolute_source_path, $relative_source_path, $prefix='', $is_private = false) { | |
| 613 | 613 | if ( |
| 614 | 614 | isset($absolute_source_path) && !empty($absolute_source_path) && |
| 615 | 615 | isset($relative_source_path) && !empty($relative_source_path) |
| 616 | 616 | ) { |
| @@ -615,9 +615,16 @@ | ||
| 615 | 615 | isset($relative_source_path) && !empty($relative_source_path) |
| 616 | 616 | ) { |
| 617 | 617 | $file_name = wp_basename( $relative_source_path ); |
| 618 | 618 | if ($file_name) { |
| 619 | - $upload_path = Utils::generate_object_key($relative_source_path, $prefix); | |
| 619 | + $upload_path = Utils::generate_object_key($relative_source_path, $prefix, $is_private); | |
| 620 | + if ($upload_path === false) { | |
| 621 | + return [ | |
| 622 | + 'success' => false, | |
| 623 | + 'code' => 200, | |
| 624 | + 'message' => esc_html__('This file is marked private, but the private-media add-on is not currently active — reupload skipped to avoid exposing it.', 'media-cloud-sync') | |
| 625 | + ]; | |
| 626 | + } | |
| 620 | 627 | return $this->execute_upload($absolute_source_path, $upload_path); |
| 621 | 628 | } |
| 622 | 629 | } |
| 623 | 630 | |