Skip to content

Commit

Permalink
WP-Stateless 3.2.0 doesn’t upload docs, only images #638
Browse files Browse the repository at this point in the history
  • Loading branch information
planv committed May 18, 2022
1 parent 752ff0e commit 3ddfe25
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/classes/class-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static function add_media($metadata, $attachment_id, $force = false, $arg

$image_host = ud_get_stateless_media()->get_gs_host();
$bucketLink = apply_filters('wp_stateless_bucket_link', $image_host);
$fullsizepath = wp_normalize_path(wp_get_original_image_path($attachment_id));
$fullsizepath = wp_normalize_path(get_attached_file($attachment_id));
$_cacheControl = self::getCacheControl($attachment_id, $metadata, null);
$_contentDisposition = self::getContentDisposition($attachment_id, $metadata, null);

Expand Down Expand Up @@ -443,7 +443,7 @@ public static function get_path_and_url($metadata, $attachment_id) {
}

$gs_name_path = array();
$full_size_path = wp_get_original_image_path($attachment_id);
$full_size_path = get_attached_file($attachment_id);
$base_dir = dirname($full_size_path);

$gs_name = apply_filters('wp_stateless_file_name', $full_size_path, true, $attachment_id, '');
Expand Down Expand Up @@ -969,7 +969,7 @@ public static function process_image_by_id($id) {
if (!$image || 'attachment' != $image->post_type || 'image/' != substr($image->post_mime_type, 0, 6))
throw new UnprocessableException(sprintf(__('Failed to process item: %s is an invalid image ID.', ud_get_stateless_media()->domain), $id));

$fullsizepath = wp_get_original_image_path($image->ID);
$fullsizepath = get_attached_file($image->ID);

// If no file found
if (false === $fullsizepath || !file_exists($fullsizepath)) {
Expand Down Expand Up @@ -1026,7 +1026,7 @@ public static function process_file_by_id($id) {
throw new UnprocessableException(sprintf(__('Attachment not found: %s is an invalid file ID.', ud_get_stateless_media()->domain), $id));
}

$fullsizepath = wp_get_original_image_path($file->ID);
$fullsizepath = get_attached_file($file->ID);
$local_file_exists = file_exists($fullsizepath);

if (false === $fullsizepath || !$local_file_exists) {
Expand Down

0 comments on commit 3ddfe25

Please sign in to comment.