You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We received a report in https://wordpress.org/support/topic/file-couldnt-be-sanitized-error/ stating that certain files couldn't be uploaded. After investigating the issue, we discovered that files larger than 10mb were being rejected due to the DOMDocument limit. We found a solution in version 0.18.0 of enshrined/svg-sanitize that allows us to bypass this limit using $this->sanitizer->setAllowHugeFiles( true );.
However, this solution disables the max recursion limits within the XML parser. As it is unlikely that users will regularly upload SVG files larger than 10mb, I suggest adding this option to the settings instead. When enabled, it sets setAllowHugeFiles() to true, allowing users who need to upload large files to do so without affecting everyone else.
Steps to Reproduce
Install plugin.
Try to upload an SVG that's larger than 10mb.
See issue.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
After looking into the issue, we found that files larger than 10MB encounter upload issues due to a limit within the DOMDocument.
We’ve identified a solution available in version 0.18.0 of enshrined/svg-sanitize, which includes an option to bypass this file size limit by setting $this->sanitizer->setAllowHugeFiles(true);. However, using this setting disables XML parser recursion limits, which could affect stability if left on by default.
Given that large SVG files (over 10MB) are rare, we suggest adding a setting to enable this feature only when needed. This way, users who require larger file uploads can enable setAllowHugeFiles(), while regular uploads remain unaffected.
Describe the bug
We received a report in https://wordpress.org/support/topic/file-couldnt-be-sanitized-error/ stating that certain files couldn't be uploaded. After investigating the issue, we discovered that files larger than 10mb were being rejected due to the
DOMDocument
limit. We found a solution in version0.18.0
ofenshrined/svg-sanitize
that allows us to bypass this limit using$this->sanitizer->setAllowHugeFiles( true );
.However, this solution disables the max recursion limits within the XML parser. As it is unlikely that users will regularly upload SVG files larger than 10mb, I suggest adding this option to the settings instead. When enabled, it sets
setAllowHugeFiles()
totrue
, allowing users who need to upload large files to do so without affecting everyone else.Steps to Reproduce
Code of Conduct
The text was updated successfully, but these errors were encountered: