From 7744a04ae71b18cf8b89eaf5c7dd466401f13ec5 Mon Sep 17 00:00:00 2001 From: crvi Date: Sat, 4 Jul 2020 14:46:52 +0530 Subject: [PATCH] podcast: podcast download should not fail when local file is empty --- podcast/rb-podcast-manager.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c index 3259a8453..6d4c80aa4 100644 --- a/podcast/rb-podcast-manager.c +++ b/podcast/rb-podcast-manager.c @@ -954,7 +954,9 @@ download_podcast (GFileInfo *src_info, RBPodcastManagerInfo *data) local_size = g_file_info_get_attribute_uint64 (dest_info, G_FILE_ATTRIBUTE_STANDARD_SIZE); g_object_unref (dest_info); - if (local_size == data->download_size) { + if (local_size == 0) { + rb_debug ("local file is empty"); + } else if (local_size == data->download_size) { GValue val = {0,}; rb_debug ("local file is the same size as the download (%" G_GUINT64_FORMAT ")", @@ -1617,10 +1619,12 @@ podcast_download_thread (RBPodcastManagerInfo *data) /* open local file */ if (data->out_stream == NULL) { - data->out_stream = g_file_create (data->destination, - G_FILE_CREATE_NONE, - data->cancel, - &error); + data->out_stream = g_file_replace (data->destination, + NULL, + FALSE, + G_FILE_CREATE_NONE, + data->cancel, + &error); if (error != NULL) { download_error (data, error); g_error_free (error); -- GitLab