Skip to content

Commit

Permalink
fix: Don't try to transform bool
Browse files Browse the repository at this point in the history
Fixes #93
  • Loading branch information
octfx committed Apr 28, 2024
1 parent 40f5a00 commit 05575f8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions includes/Media/VideoHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,23 @@ public function normaliseParams( $image, &$params ): bool {

if ( $title !== null && $title->exists() ) {
$coverFile = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title );
$transform = $coverFile->transform( [ 'width' => $params['width'] ] );

try {
$params['posterUrl'] = MediaWikiServices::getInstance()->getUrlUtils()->expand(
$transform->getUrl()
);
if ( !$coverFile !== false ) {
$transform = $coverFile->transform( [ 'width' => $params['width'] ] );

} catch ( Exception $e ) {
unset( $params['poster'], $params['posterUrl'] );
try {
$params['posterUrl'] = MediaWikiServices::getInstance()->getUrlUtils()->expand(
$transform->getUrl()
);
} catch ( Exception $e ) {
unset( $params['posterUrl'] );
}
}
} else {
unset( $params['poster'] );
}
}

unset( $params['poster'] );

if ( isset( $params['lazy'] ) ) {
$params['lazy'] = true;
} else {
Expand Down

0 comments on commit 05575f8

Please sign in to comment.