feat(clone): allow maxSize limit to prevent downloading huge assets (videos) when cloning as site #31592
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.
This pull request introduces a new feature to limit the size of assets included in ZIP files during export operations. The changes include adding a new parameter for maximum file size,
maxSize
updating various methods to handle this parameter, and creating a utility class for size conversion.Usages:
?maxSize=1g
gb?maxSize=10m
mb?maxSize=3mb
mb?maxSize=512k
kb?maxSize=10240
bytesKey Changes
New Feature: Maximum File Size for Assets
dotCMS/src/main/java/com/dotcms/rest/api/v1/maintenance/MaintenanceResource.java
:maxSize
parameter to methodsdownloadAssets
,downloadStarter
, anddownloadStarterWithAssets
. IncorporatedSizeUtil.convertToBytes
to convert the size string to bytes and pass it to the export methods. [1] [2] [3]dotCMS/src/main/java/com/dotcms/util/SizeUtil.java
:SizeUtil
class with a methodconvertToBytes
to convert human-readable size strings (e.g., "1mb", "512k") to bytes.Updates to Export Functionality
dotCMS/src/main/java/com/dotmarketing/portlets/cmsmaintenance/util/AssetFileNameFilter.java
:AssetFileNameFilter
constructor to accept amaxFileSize
parameter and updated theaccept
method to filter out files exceeding the specified size. [1] [2]dotCMS/src/main/java/com/dotmarketing/util/starter/ExportStarterUtil.java
:streamCompressedStarter
andstreamCompressedAssets
to acceptmaxFileSize
and pass it to thestreamCompressedData
method. [1] [2]User Interface Enhancements
dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/view_cms_maintenance.jsp
: