Skip to content

Commit 6077f05

Browse files
committed
fix: file permissions after move
1 parent 1c63d0e commit 6077f05

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

inc/media_rename/attachment_rename.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public function rename() {
7676
return new WP_Error( 'optml_attachment_rename_failed', __( 'Error renaming file.', 'optimole-wp' ) );
7777
}
7878

79+
$wp_filesystem->chmod( $new_file_path, FS_CHMOD_FILE );
80+
7981
// Move the scaled image if it exists.
8082
if ( $this->attachment->is_scaled() ) {
8183
$new_unique_filename_no_ext = pathinfo( $new_unique_filename, PATHINFO_FILENAME );

inc/media_rename/attachment_replace.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public function replace() {
8383
return new WP_Error( 'file_error', __( 'Could not move file.', 'optimole-wp' ) );
8484
}
8585

86+
$wp_filesystem->chmod( $original_file, FS_CHMOD_FILE );
87+
8688
$this->remove_all_image_sizes();
8789

8890
clean_attachment_cache( $this->attachment_id );

0 commit comments

Comments
 (0)