]> BookStack Code Mirror - bookstack/commit
ZIP Imports: Added image type validation/handling
authorDan Brown <redacted>
Mon, 18 Nov 2024 17:42:49 +0000 (17:42 +0000)
committerDan Brown <redacted>
Mon, 18 Nov 2024 17:42:49 +0000 (17:42 +0000)
commit59cfc087e12c8752b4a9f1760db71a13ad6c121c
treef5b35531af76eaaaf901645667e0a9da3d2b6f82
parente2f6e50df4347579e3b6eb8e7c48bfcb79199a64
ZIP Imports: Added image type validation/handling

Images were missing their extension after import since it was
(potentially) not part of the import data.
This adds validation via mime sniffing (to match normal image upload
checks) and also uses the same logic to sniff out a correct extension.

Added tests to cover.
Also fixed some existing tests around zip functionality.
app/Exports/ZipExports/Models/ZipExportImage.php
app/Exports/ZipExports/ZipExportReader.php
app/Exports/ZipExports/ZipFileReferenceRule.php
app/Exports/ZipExports/ZipImportRunner.php
app/Exports/ZipExports/ZipValidationHelper.php
lang/en/validation.php
tests/Exports/ZipExportTest.php
tests/Exports/ZipExportValidatorTest.php [moved from tests/Exports/ZipExportValidatorTests.php with 77% similarity]
tests/Exports/ZipImportRunnerTest.php