From eeb6995f2e077991576b35956983bbefe34cf057 Mon Sep 17 00:00:00 2001 From: Kentaro Wada Date: Sun, 12 May 2024 15:34:55 +0900 Subject: [PATCH] Use .part suffix to represent partially downloaded files --- gdown/download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdown/download.py b/gdown/download.py index cd242f1..baadef1 100644 --- a/gdown/download.py +++ b/gdown/download.py @@ -302,7 +302,7 @@ def download( existing_tmp_files = [] for file in os.listdir(osp.dirname(output) or "."): - if file.startswith(osp.basename(output)): + if file.startswith(osp.basename(output)) and file.endswith(".part"): existing_tmp_files.append(osp.join(osp.dirname(output), file)) if resume and existing_tmp_files: if len(existing_tmp_files) != 1: @@ -325,7 +325,7 @@ def download( # mkstemp is preferred, but does not work on Windows # https://github.com/wkentaro/gdown/issues/153 tmp_file = tempfile.mktemp( - suffix=tempfile.template, + suffix=".part", prefix=osp.basename(output), dir=osp.dirname(output), )