mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-07 23:03:00 +03:00
ZIP Import & Exports: Addressed issues during testing
- Handled links to within-zip page images found in chapter/book descriptions; Added test to cover. - Fixed session showing unrelated success on failed import. Tested import file-create undo on failure as part of this testing.
This commit is contained in:
@@ -89,6 +89,8 @@ class ImportController extends Controller
|
||||
try {
|
||||
$entity = $this->imports->runImport($import, $parent);
|
||||
} catch (ZipImportException $exception) {
|
||||
session()->flush();
|
||||
$this->showErrorNotification(trans('errors.import_zip_failed_notification'));
|
||||
return redirect($import->getUrl())->with('import_errors', $exception->errors);
|
||||
}
|
||||
|
||||
|
@@ -127,11 +127,12 @@ class ZipExportReferences
|
||||
return null;
|
||||
}
|
||||
|
||||
// We don't expect images to be part of book/chapter content
|
||||
if (!($exportModel instanceof ZipExportPage)) {
|
||||
return null;
|
||||
// Handle simple links outside of page content
|
||||
if (!($exportModel instanceof ZipExportPage) && isset($this->images[$model->id])) {
|
||||
return "[[bsexport:image:{$model->id}]]";
|
||||
}
|
||||
|
||||
// Find and include images if in visibility
|
||||
$page = $model->getPage();
|
||||
if ($page && userCan('view', $page)) {
|
||||
if (!isset($this->images[$model->id])) {
|
||||
|
Reference in New Issue
Block a user