Bug 159474 - A specific broken document can't be opened in RepairPackage mode
Summary: A specific broken document can't be opened in RepairPackage mode
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.8.0 target:24.2.1
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-31 13:43 UTC by Mike Kaganski
Modified: 2024-02-01 14:13 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
A document package with a stream not referenced in its manifest.xml (10.07 KB, application/vnd.oasis.opendocument.text)
2024-01-31 13:43 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-01-31 13:43:03 UTC
Created attachment 192283 [details]
A document package with a stream not referenced in its manifest.xml

The attachment is just a simple Writer document (having text "Empty document"), manually edited using 7-Zip to add an empty text file "unreferenced.txt" into its root directory, without also adding a reference to it into the package's manifest.xml. This is an invalid ODF; and LibreOffice naturally asks to repair it on normal opening. When user agrees, the document opens normally.

Try to run this macro to open this attachment in RepairPackage mode:

sub OpenRepairPackage
  url = ConvertToURL("Path/To/unreferenced_stream.odt")
  dim args(0) as new com.sun.star.beans.PropertyValue
  args(0).Name = "RepairPackage"
  args(0).Value = true
  StarDesktop.loadComponentFromURL(url, "_blank", 0, args())
end sub

This macro (with corrected path to the file) results in "General input/output error." message, and the document isn't opened. It obviously should, because the RepairPackage MediaDescriptor property [1] serves as explicit request to try to repair it.

[1] https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1document_1_1MediaDescriptor.html#ab5ae6f2c9a82bcb8f006f4b46fee1691
Comment 1 Commit Notification 2024-02-01 08:46:17 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6c62129e64eb5ef00dfa5f2137c8689d55190163

tdf#159474: fix handling of pre-set RepairPackage property

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 2 Commit Notification 2024-02-01 14:13:39 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/cffe6b2d7925d92424f1d6e02dafd32c1c9679cf

tdf#159474: fix handling of pre-set RepairPackage property

It will be available in 24.2.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.