Preview archives only if smaller than a specified size #2984 #3114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ISSUE TYPE
RUNTIME ENVIRONMENT
ranger version: ranger-master
Python version: 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0]
Locale: en_US.UTF-8
Debian 12 "Bookworm"
CHECKLIST
CONTRIBUTINGdocument has been read [REQUIRED]DESCRIPTION
max_archive_preview_sizeon rc.conf, it looks like thisset max_archive_preview_size 20MALLOWED_SETTINGSinsidecontainer/settings.pyfile like this:'max_archive_preview_size': str,parse_human_readablefunction intoext/human_readable.pyfile (used for parsing human readable option 20M and convert it into bytes)is_archive_preview_allowedfunction intocontainer/file.pyfile. This function getsmax_archive_preview_sizefrom settings, compare its value with current file size and returns True or Falsehas_previewfunction from the same file. This is modified part:this
self.is_archive_preview_allowed(self.path)returns true ifmax_archive_preview_sizeis blank or equal to zero or if its value is greater or equal to file size. So, nothing is broken. All these modifications affects only on "container" files and only if their size is greater thanmax_archive_preview_size(and only when preview script is used). In all other cases everything should work as worked before.UPD:
Modified
mkdirfromcommands.py. Now it can create multiple folders at onceMOTIVATION AND CONTEXT
#2984