Skip to content

Commit

Permalink
NXDRIVE-2925: Ignore zero-byte files (#5372)
Browse files Browse the repository at this point in the history
* NXDRIVE-2925: Ignore zero-byte files
  • Loading branch information
gitofanindya authored Nov 11, 2024
1 parent c5b58eb commit c0fac40
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changes/5.5.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Release date: `2024-xx-xx`

- [NXDRIVE-2909](https://jira.nuxeo.com/browse/NXDRIVE-2909): Set container title when defining the Folder type from Document Type Selection using Direct Transfer
- [NXDRIVE-2915](https://jira.nuxeo.com/browse/NXDRIVE-2915): Translate "Document type" and "container type" labels on Direct Transfer popup
- [NXDRIVE-2925](https://jira.nuxeo.com/browse/NXDRIVE-2925): Ignore zero-byte files

### Task Management
- [NXDRIVE-2](https://jira.nuxeo.com/browse/NXDRIVE-2):
Expand Down
12 changes: 11 additions & 1 deletion nxdrive/gui/folders_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,9 @@ def _files_display(self) -> str:
txt += f" (+{self.overall_count - 1:,})"
return txt

def get_size(self, file_path: Path) -> bool:
return file_path.stat().st_size

def _process_additionnal_local_paths(self, paths: List[str], /) -> None:
"""Append more local paths to the upload queue."""
for local_path in paths:
Expand All @@ -647,10 +650,17 @@ def _process_additionnal_local_paths(self, paths: List[str], /) -> None:
# Save the path
if path.is_dir():
for file_path, size in get_tree_list(path):
if self.get_size(file_path) == 0:
# ignoring zero byte files [NXDRIVE-2925]
continue
self.paths[file_path] = size
else:
try:
self.paths[path] = path.stat().st_size
file_size = self.get_size(path)
if file_size == 0:
# ignoring zero byte files [NXDRIVE-2925]
continue
self.paths[path] = file_size
except OSError:
log.warning(f"Error calling stat() on {path!r}", exc_info=True)
continue
Expand Down

0 comments on commit c0fac40

Please sign in to comment.