Skip to content

Commit 7815aa3

Browse files
authored
Merge pull request #35 from lutraconsulting/problem_download_files_with_size_0
fix problem with download files with zero size
2 parents 8b2a7fb + a97920a commit 7815aa3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mergin/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,11 @@ def _download_file(self, project_path, file, directory, parallel=True, diff_only
10261026
file_dir = os.path.dirname(os.path.normpath(os.path.join(directory, file['path'])))
10271027
basename = os.path.basename(file['diff']['path']) if diff_only else os.path.basename(file['path'])
10281028

1029+
if file['size'] == 0:
1030+
os.makedirs(file_dir, exist_ok=True)
1031+
open(os.path.join(file_dir, basename), 'w').close()
1032+
return file["path"]
1033+
10291034
def download_file_part(part):
10301035
"""Callback to get a part of file using request to server with Range header."""
10311036
start = part * (1 + CHUNK_SIZE)

0 commit comments

Comments
 (0)