Skip to content

Commit 58846d5

Browse files
authored
nemo-file-operations.c: Fix file copies breaking ownership rules. (#3731)
Removes G_FILE_COPY_ALL_METADATA flag for copies. Default metadata is already copied, but this was overriding ownership of the source when it wasn't appropriate. Fixes #3730.
1 parent 0446b9e commit 58846d5

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

libnemo-private/nemo-file-operations.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3991,8 +3991,13 @@ copy_move_directory (CopyMoveJob *copy_job,
39913991
}
39923992

39933993
if (create_dest) {
3994-
flags = (readonly_source_fs) ? G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_TARGET_DEFAULT_PERMS
3995-
: G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA;
3994+
flags = G_FILE_COPY_NOFOLLOW_SYMLINKS;
3995+
if (readonly_source_fs) {
3996+
flags |= G_FILE_COPY_TARGET_DEFAULT_PERMS;
3997+
} else if (copy_job->is_move) {
3998+
flags |= G_FILE_COPY_ALL_METADATA;
3999+
}
4000+
39964001
/* Ignore errors here. Failure to copy metadata is not a hard error */
39974002
g_file_copy_attributes (src, *dest,
39984003
flags,
@@ -4561,13 +4566,6 @@ copy_move_file (CopyMoveJob *copy_job,
45614566
}
45624567

45634568
if (res) {
4564-
if (!copy_job->is_move) {
4565-
/* Ignore errors here. Failure to copy metadata is not a hard error */
4566-
g_file_copy_attributes (src, dest,
4567-
flags | G_FILE_COPY_ALL_METADATA,
4568-
job->cancellable, NULL);
4569-
}
4570-
45714569
transfer_info->num_files ++;
45724570
report_copy_progress (copy_job, source_info, transfer_info);
45734571

0 commit comments

Comments
 (0)