cloudverve / wordpress-cloud-media-offloader-plugin

A simple plugin that allows you to serve your WordPress Media Library files from the Backblaze B2 cloud storage service.
GNU General Public License v2.0
65 stars 14 forks source link

When using root folder, you need to untrailslash line 178 in b2.php #16

Open jrhager84 opened 3 years ago

jrhager84 commented 3 years ago

When using root folder with b2, there's an additional trailing slash that breaks the links in the media library. starting at line 171:

return array( 'ID' => $attachment_id, 'filepath' => $filepath, 'filename' => basename( $filepath ), 'url' => wp_get_attachment_url( $attachment_id ), 'subdir' => trim( $uploads['subdir'], DIRECTORY_SEPARATOR ), 'destpath' => $remote_path . untrailingslashit( $uploads['subdir'] ), 'destfile' => $remote_path . untrailingslashit( $uploads['subdir'] ) . basename( $filepath ), // This is the line that went from trail to untrail 'mime_type' => get_post_mime_type( $attachment_id ) );