Skip to content

Commit

Permalink
Handle incorrect parameters gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
bobvandevijver committed Dec 17, 2023
1 parent 7b8c7e0 commit 2601faa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Controller/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ private function parseParameters(string $paramString): void
$raw = explode('×', preg_replace('/([0-9])(x)([0-9a-z])/i', '\1×\3', $paramString));

$this->parameters = [
'w' => is_numeric($raw[0]) ? (int) $raw[0] : 400,
'h' => is_numeric($raw[1]) ? (int) $raw[1] : 300,
'w' => (isset($raw[0] && is_numeric($raw[0])) ? (int) $raw[0] : 400,

Check failure on line 146 in src/Controller/ImageController.php

View workflow job for this annotation

GitHub Actions / PHPStan

Syntax error, unexpected ',' on line 146

Check failure on line 146 in src/Controller/ImageController.php

View workflow job for this annotation

GitHub Actions / PHPStan

Syntax error, unexpected ',' on line 146
'h' => (isset($raw[1]) && is_numeric($raw[1])) ? (int) $raw[1] : 300,

Check failure on line 147 in src/Controller/ImageController.php

View workflow job for this annotation

GitHub Actions / PHPStan

Syntax error, unexpected ',' on line 147

Check failure on line 147 in src/Controller/ImageController.php

View workflow job for this annotation

GitHub Actions / PHPStan

Syntax error, unexpected ',' on line 147
'fit' => isset($raw[2]) ? $raw[2] : $this->config->get('general/thumbnails/default_cropping', 'default'),

Check failure on line 148 in src/Controller/ImageController.php

View workflow job for this annotation

GitHub Actions / PHPStan

Syntax error, unexpected ',' on line 148

Check failure on line 148 in src/Controller/ImageController.php

View workflow job for this annotation

GitHub Actions / PHPStan

Syntax error, unexpected ',' on line 148
'location' => 'files',
'q' => (!empty($raw[2]) && 0 <= $raw[2] && $raw[2] <= 100) ? (int) $raw[2] : 80
Expand Down

0 comments on commit 2601faa

Please sign in to comment.