Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Fix pdf scanner #16956

Draft
wants to merge 3 commits into
base: 11.2
Choose a base branch
from
Draft

[Bug]: Fix pdf scanner #16956

wants to merge 3 commits into from

Conversation

kingjia90
Copy link
Contributor

@kingjia90 kingjia90 commented Apr 17, 2024

Changes in this pull request

Resolves #16318
Requires pimcore/admin-ui-classic-bundle#498

Additional info

It seems the problem was that the sanitization would be re-dispatched on every reload and at least every 5 seconds, because the in progress is not saved and was always null
Also if processBackground is false, it's appearing as in progress all the time, due to the line above it.

Copy link

Review Checklist

  • Target branch (11.2 for bug fixes, others 11.x)
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

Copy link

sonarcloud bot commented Apr 17, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

$asset->setCustomSetting($asset::CUSTOM_SETTING_PDF_SCAN_STATUS, PdfScanStatus::UNSAFE->value);
$note = 'unsafe';
}
$asset->save(['versionNote' => 'PDF scan result:' . $note]);
Copy link
Contributor Author

@kingjia90 kingjia90 Apr 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mhhh, this could be bad, if by uploading a pdf that takes 5 seconds to check, and within that time, it's replaced by a new one that takes 1 second, by the time it finishes the first task, it would add a newer version with a earlier date than the creation date of the latest one, or things like that.

That's probably why it uses saveAsset() that avoid Versioning.
Is it async or sync?
Is it necessary vernsioNote? could it be moved to metadata?

@kingjia90 kingjia90 changed the title [Bug]: Fix pdf sanitizer [Bug]: Fix pdf scanner Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants