aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2022-11-01 20:24:35 -0600
committerfiaxh <git@lightrise.org>2022-11-02 09:57:03 -0600
commit809c1579e41000f2f43eeb05735afc8165a1a430 (patch)
tree02a2caa16ada8ab1c9aadbbfe0d3d06857b15c1d /libdino/src/service
parenta2f2224781a82121c86a1f19b309245bc8369a91 (diff)
downloaddino-809c1579e41000f2f43eeb05735afc8165a1a430.tar.gz
dino-809c1579e41000f2f43eeb05735afc8165a1a430.zip
Don't use splice when handling input streams from libsoup-3
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/file_manager.vala10
1 files changed, 9 insertions, 1 deletions
diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala
index b82e0afb..89ae1ce1 100644
--- a/libdino/src/service/file_manager.vala
+++ b/libdino/src/service/file_manager.vala
@@ -246,7 +246,15 @@ public class FileManager : StreamInteractionModule, Object {
File file = File.new_for_path(Path.build_filename(get_storage_dir(), filename));
OutputStream os = file.create(FileCreateFlags.REPLACE_DESTINATION);
- yield os.splice_async(input_stream, OutputStreamSpliceFlags.CLOSE_SOURCE | OutputStreamSpliceFlags.CLOSE_TARGET, Priority.LOW, file_transfer.cancellable);
+ uint8[] buffer = new uint8[1024];
+ ssize_t read;
+ while ((read = yield input_stream.read_async(buffer, Priority.LOW, file_transfer.cancellable)) > 0) {
+ buffer.length = (int) read;
+ yield os.write_async(buffer, Priority.LOW, file_transfer.cancellable);
+ buffer.length = 1024;
+ }
+ yield input_stream.close_async(Priority.LOW, file_transfer.cancellable);
+ yield os.close_async(Priority.LOW, file_transfer.cancellable);
file_transfer.path = file.get_basename();
file_transfer.input_stream = yield file.read_async();