fix: move ODT source unlink before download block to ensure cleanup on exception#38936
Open
support-accellier wants to merge 4 commits into
Open
fix: move ODT source unlink before download block to ensure cleanup on exception#38936support-accellier wants to merge 4 commits into
support-accellier wants to merge 4 commits into
Conversation
eldy
reviewed
Jun 21, 2026
|
|
||
| if ($dooutputfordownload) { | ||
| if (php_sapi_name() != 'cli') { // If we are in a web context (not into CLI context) | ||
| if (headers_sent($filename, $linenum)) { |
Member
There was a problem hiding this comment.
If a header was sent, it means we got a problem into odt to pdf conversion. In such a case, we would like to keep the odt file, so we can analyze it, to try to reproduce to problem with the source file.
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.
Summary
Moves the
unlink($name)call (controlled byMAIN_ODT_AS_PDF_DEL_SOURCE) to before the$dooutputfordownloadblock inodf.php::exportAsAttachedPDF().Previously, if
headers_sent()caused anOdfExceptionto be thrown inside the download block, theunlink()was never reached and the.odtsource file remained on disk despiteMAIN_ODT_AS_PDF_DEL_SOURCEbeing enabled. The PDF conversion is already complete at this point, so deleting the ODT source before attempting the download is safe and ensures cleanup always happens.Fixes #38930