aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Storage
diff options
context:
space:
mode:
authordaniel <dkinzler@wikimedia.org>2022-06-29 19:01:21 +0200
committerDaniel Kinzler <dkinzler@wikimedia.org>2022-06-30 14:54:42 +0000
commit2ba27ab06ee58fa8011a44d2e51161c24b6367cd (patch)
treeb488c198baf222dc6159019512f990fa316365cc /includes/Storage
parent3f204f285ded7848bdaa7cb7af5cac3fc549e44c (diff)
downloadmediawikicore-2ba27ab06ee58fa8011a44d2e51161c24b6367cd.tar.gz
mediawikicore-2ba27ab06ee58fa8011a44d2e51161c24b6367cd.zip
Protect against passing unsupported content models to Parsoid.
Parsoid currently only supports wikitext (and JSON), so don't give it anything else. NOTE: ParsoidOutputAccess will fail on content that is unsupported by parsoid. This will however not affect the /transform and /page endpoints in the parsoid extension, since they use the ParsoidHandler base class, which doesn't rely on ParsoidOutputAccess. Bug: T301371 Change-Id: I6bc9b978947b31455a4bce6385b7bdf64ed4043c
Diffstat (limited to 'includes/Storage')
-rw-r--r--includes/Storage/DerivedPageDataUpdater.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/includes/Storage/DerivedPageDataUpdater.php b/includes/Storage/DerivedPageDataUpdater.php
index ef4377b0e753..dbe3c1350c26 100644
--- a/includes/Storage/DerivedPageDataUpdater.php
+++ b/includes/Storage/DerivedPageDataUpdater.php
@@ -1840,6 +1840,12 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface, P
$rev = $this->getRevision();
$parserOpts = $this->getCanonicalParserOptions();
+ $mainSlot = $rev->getSlot( SlotRecord::MAIN );
+ if ( !$this->parsoidOutputAccess->supportsContentModel( $mainSlot->getModel() ) ) {
+ $this->logger->debug( __METHOD__ . ': Parsoid does not support content model ' . $mainSlot->getModel() );
+ return;
+ }
+
// Make sure that ParsoidOutputAccess recognizes the revision as the current one.
Assert::precondition(
$wikiPage->getLatest() === $rev->getId(),