Skip to content

Commit

Permalink
fix a bug that broke the live view
Browse files Browse the repository at this point in the history
  • Loading branch information
ata-no-one committed Oct 15, 2024
1 parent 685dead commit ae2c175
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Vaas/ScanClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ public function scan_post( $data, $postdata, $unsanitized_postarr ) {
$post_content = wp_unslash($postdata['post_content']);
$stream = $this->file_system->get_resource_stream_from_string($post_content);

$verdict = $this->vaas->ForStream($stream);
try {
$verdict = $this->vaas->ForStream($stream);
} catch (\Exception $e) {
$this->connect();
$verdict = $this->vaas->ForStream($stream);
}
$this->logger->debug(var_export($verdict, true));
// phpcs:ignore
if (\VaasSdk\Message\Verdict::MALICIOUS === $verdict->Verdict) {
Expand Down Expand Up @@ -138,8 +143,12 @@ public function scan_comment( $commentdata ) {

$commend_content = wp_unslash($commentdata['comment_content']);
$stream = $this->file_system->get_resource_stream_from_string($commend_content);

$verdict = $this->vaas->ForStream($stream);
try {
$verdict = $this->vaas->ForStream($stream);
} catch (\Exception $e) {
$this->connect();
$verdict = $this->vaas->ForStream($stream);
}
$this->logger->debug(var_export($verdict, true));
// phpcs:ignore
if (\VaasSdk\Message\Verdict::MALICIOUS === $verdict->Verdict) {
Expand Down

0 comments on commit ae2c175

Please sign in to comment.