Skip to content

fix(templates): avoid extra file write - #5971

Merged
elzody merged 1 commit into
mainfrom
fix/template-antivirus-double-scan
Aug 24, 2026
Merged

fix(templates): avoid extra file write#5971
elzody merged 1 commit into
mainfrom
fix/template-antivirus-double-scan

Conversation

@elzody

@elzody elzody commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

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

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Documentation (manuals or wiki) has been updated or is not required

@elzody
elzody requested review from moodyjmz and rikled August 10, 2026 22:00
@elzody elzody self-assigned this Aug 10, 2026
@elzody
elzody requested a review from juliusknorr as a code owner August 10, 2026 22:00
@elzody elzody added the 3. to review Ready to be reviewed label Aug 10, 2026
@elzody
elzody force-pushed the fix/template-antivirus-double-scan branch 2 times, most recently from b19aff9 to 0e10eea Compare August 12, 2026 16:03
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
elzody force-pushed the fix/template-antivirus-double-scan branch from eb2d358 to 8f798d3 Compare August 21, 2026 21:51

@moodyjmz moodyjmz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@elzody

elzody commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

/backport to stable34 please

@elzody

elzody commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

/backport to stable33 please

@elzody

elzody commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

/backport to stable32 please

@elzody
elzody merged commit 0c302c8 into main Aug 24, 2026
64 checks passed
@elzody
elzody deleted the fix/template-antivirus-double-scan branch August 24, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants