Skip to content

Commit

Permalink
fix media upload scan
Browse files Browse the repository at this point in the history
  • Loading branch information
ata-no-one committed Oct 11, 2024
1 parent 6f56c85 commit ca3d633
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion Infrastructure/FileSystem/FileSystemBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ trait FileSystemBase {
public function get_resource_stream_from_string( string $content ): ReadableResourceStream {
$stream = fopen('php://temp', 'r+');
fwrite($stream, $content);
rewind($stream);
return tryToCreateReadableStreamFromResource($stream);
}

Expand Down
10 changes: 3 additions & 7 deletions Vaas/ScanClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(

$post_scan_enabled = (bool) \get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_post_scan_enabled', true);
if ($post_scan_enabled === true) {
\add_filter('wp_insert_post_data', array( $this, 'scan_post' ));
\add_filter('wp_insert_post_data', array( $this, 'scan_post' ), 10, 3);
}
}

Expand Down Expand Up @@ -159,12 +159,8 @@ public function scan_single_upload( $file ) {
*/
$is_plugin_uplad = false;

$action = \sanitize_key($_GET['action'] ?? $_POST['action'] ?? '');
if (isset($_POST['_wpnonce'])) {
$nonce = \sanitize_key($_POST['nonce'] ?? $_POST['_wpnonce']);
} else {
$nonce = \sanitize_key($_GET['nonce'] ?? '');
}
$action = sanitize_key($_REQUEST['action'] ?? '');
$nonce = wp_unslash($_REQUEST['_wpnonce'] ?? $_REQUEST['nonce']);
if ($action === 'upload-plugin') {
if (wp_verify_nonce($nonce, $action) === false) {
return $file;
Expand Down

0 comments on commit ca3d633

Please sign in to comment.