fix(templates): avoid extra file write - #5971
Merged
Merged
Conversation
elzody
force-pushed
the
fix/template-antivirus-double-scan
branch
2 times, most recently
from
August 12, 2026 16:03
b19aff9 to
0e10eea
Compare
Avoids an extra file write when no template fields are provided. Not only does this avoid an extra write to the file, but it consequently also prevents the files_antivirus app from doing a second, sequential scan on the file; this should reduce the latency between creating a file and seeing it. Signed-off-by: Elizabeth Danzberger <elizabeth@elzody.dev> Assisted-by: ClaudeCode:claude-sonnet-4-6
elzody
force-pushed
the
fix/template-antivirus-double-scan
branch
from
August 21, 2026 21:51
eb2d358 to
8f798d3
Compare
rikled
approved these changes
Aug 21, 2026
moodyjmz
approved these changes
Aug 24, 2026
moodyjmz
left a comment
Collaborator
There was a problem hiding this comment.
Verified the mechanism: this restores the pre-existing setTemplateSource fallback for the empty-fields case, matching the intent of the earlier commit that gated it behind hasFormFilling(). Chased down a possible PDF-flatten regression (PdfService::fillFields unconditionally flattens) — confirmed unreachable, since no PDF template creator is registered anywhere in richdocuments, so the template file can never be a PDF here.
Two minor non-blocking notes, not relevant to this PR's correctness:
- extractFields() gates on Capabilities::MIMETYPES, which excludes MIMETYPES_MSOFFICE — so template field-filling is already inert for default (ooxml) installs, independent of this change. Worth its own issue.
- No test coverage for this listener, before or after this change.
Collaborator
Author
|
/backport to stable34 please |
Collaborator
Author
|
/backport to stable33 please |
Collaborator
Author
|
/backport to stable32 please |
This was referenced Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoids an extra file write when no template fields are provided. Not only does this avoid an extra write to the file, but it consequently also prevents the files_antivirus app from doing a second, sequential scan on the file; this should reduce the latency between creating a file and seeing it.
Assisted-by: ClaudeCode:claude-sonnet-4-6
Checklist