|
|
@@ -1,6 +1,7 @@
|
|
|
import { ErrorV3 } from '@growi/core/dist/models';
|
|
|
|
|
|
import { Revision } from '~/server/models/revision';
|
|
|
+import { normalizeLatestRevisionIfBroken } from '~/server/service/revision/normalize-latest-revision-if-broken';
|
|
|
import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
import { apiV3FormValidator } from '../../middlewares/apiv3-form-validator';
|
|
|
@@ -121,6 +122,14 @@ module.exports = (crowi) => {
|
|
|
return res.apiv3Err(new ErrorV3('Current user is not accessible to this page.', 'forbidden-page'), 403);
|
|
|
}
|
|
|
|
|
|
+ try {
|
|
|
+ // Normalize the latest revision which was borken by the migration script '20211227060705-revision-path-to-page-id-schema-migration--fixed-7549.js'
|
|
|
+ await normalizeLatestRevisionIfBroken(pageId);
|
|
|
+ }
|
|
|
+ catch (err) {
|
|
|
+ logger.error('Error occurred in normalizing the latest revision');
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
const page = await Page.findOne({ _id: pageId });
|
|
|
const queryOpts = {
|