Skip to content

Commit 4973ad0

Browse files
authored
Critical Fix: Copy files using SubprocessLauncher instead of the GFile API (#94)
2 parents e62a105 + 93e1c00 commit 4973ad0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

io.github.diegoivan.pdf_metadata_editor.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@
5252
],
5353
"sources" : [
5454
{
55-
"url" : "https://gitlab.freedesktop.org/poppler/poppler.git",
56-
"type" : "git",
57-
"tag" : "poppler-23.01.0",
58-
"commit" : "4259ff0c2067d302f97d87221a442eec8e88d45c"
55+
"url" : "https://poppler.freedesktop.org/poppler-24.08.0.tar.xz",
56+
"type" : "archive",
57+
"sha256" : "97453fbddf0c9a9eafa0ea45ac710d3d49bcf23a62e864585385d3c0b4403174"
5958
}
6059
]
6160
},

src/Document.vala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,11 @@ public class PaperClip.Document : Object {
466466
}
467467

468468
private async File create_copy_from_original () throws Error {
469+
var launcher = new SubprocessLauncher (NONE);
469470
unowned string tmp_dir = Environment.get_tmp_dir ();
470471
string destination_path = Path.build_path (Path.DIR_SEPARATOR_S,
471472
tmp_dir,
472473
"copies");
473-
474474
int res = DirUtils.create_with_parents (destination_path, 0777);
475475
if (res < 0) {
476476
throw new IOError.FAILED (@"Could not create $destination_path");
@@ -479,14 +479,15 @@ public class PaperClip.Document : Object {
479479
string destination_file = Path.build_filename (destination_path,
480480
"%s".printf (original_file.get_basename ()));
481481

482-
var copy_file = File.new_for_path (destination_file);
483-
FileCopyFlags flags = NOFOLLOW_SYMLINKS | OVERWRITE | ALL_METADATA;
484-
485-
bool success = yield original_file.copy_async (copy_file, flags);
482+
Subprocess copy_process = launcher.spawn("cp", original_file.get_path(), destination_path);
483+
bool success = yield copy_process.wait_async ();
486484
if (!success) {
487-
critical ("Copy Unsuccessful");
485+
critical ("Processed failed");
488486
}
489487

488+
489+
var copy_file = File.new_for_path (destination_file);
490+
490491
return copy_file;
491492
}
492493
}

0 commit comments

Comments
 (0)