Bug 144553 - JPG and PNG and GIF get corrupted to zero size on export if resaved under the same name
Summary: JPG and PNG and GIF get corrupted to zero size on export if resaved under the...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bibisectRequest
Depends on:
Blocks: Graphics-Export
  Show dependency treegraph
Reported: 2021-09-16 17:50 UTC by Daniel Baran
Modified: 2021-10-04 17:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Baran 2021-09-16 17:50:54 UTC
When I open a JPG and then export as JPG the result is a zero byte file.
This only happens when I overwrite to the original file name.
I have repeated this in several tests with different files.

Steps to Reproduce:
1.Open a JPG file
2.Export as JPG using the original file name
3.Agree to overwrite (per file exists warning)

Actual Results:
Output file is corrupted - byte size is zero

Expected Results:
Overwrite the original file with the modified version

Reproducible: Always

User Profile Reset: No

Additional Info:
Version: (x64) / LibreOffice Community
Build ID: 0e133318fcee89abacd6a7d077e292f1145735c3
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 1 Timur 2021-09-17 09:31:00 UTC
In LO 6.2 error dialog "Writer error. File could not be written". 
Repro LO 6.3 and 7.3+ Windows and Linux.

In Linux 6.2 and 6.3 and 6.4 master there's a crash on save, so bibisect should be done in Windows.
Comment 2 Timur 2021-09-17 10:11:40 UTC
May be the same bug: when PNG Options appear, see size, click in Resolution field, see that size becomes 0.
Comment 3 Henrik Palomäki 2021-09-21 07:15:20 UTC
Should the wanted behaviour be similar for example to the GIMP's export tool? It overwrites the file that has a same name. Or is it enough to show an error dialog and leave the file intact?
Comment 4 Daniel Baran 2021-09-21 17:15:20 UTC
I think the current message dialog is proper.
That is: "filename.jpg already exists.  Do you want to replace it?"
But presently, if you reply "yes" to overwrite, you get a zero byte file.
Comment 5 Daniel Baran 2021-10-04 17:45:07 UTC
Assuming there may be good reasons to avoid overwriting the open file,
a good alternative might be changing the message box to something like:
"filename.jpg already exists - choose a new filename."