Skip to content

Commit

Permalink
fix base64 validation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-aliraqi committed Apr 30, 2022
1 parent d54e31b commit 05fed33
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Rules/MediaRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public function __construct(...$types)
*/
public function passes($attribute, $value)
{
if (is_string($value) && base64_decode(base64_encode($value)) === $value) {
return true;
}

if (! $value instanceof UploadedFile) {
return false;
}
Expand Down Expand Up @@ -84,6 +80,10 @@ protected function getTypeString($value): string
)));
}

if (is_string($value) && base64_decode(base64_encode($value)) === $value) {
$type = 'image';
}

return $type; // either: image, video or audio.
}

Expand Down

0 comments on commit 05fed33

Please sign in to comment.