[Libreoffice-bugs] [Bug 137926] storeAsURL regression between libreoffice < 7 and libreoffice >=7
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Mon Mar 15 22:57:33 UTC 2021
https://bugs.documentfoundation.org/show_bug.cgi?id=137926
--- Comment #4 from libreoffice at neowutran.ovh ---
I searched a bit deeper and found 2 regression between 6.4.X and 7.X.
This ticket will be for only one of those, I will open a new ticket for other.
Commit 0de0b1b64a1c122254bb821ea0eb9b038875e8d4
( https://gerrit.libreoffice.org/c/core/+/104345 /
https://github.com/LibreOffice/core/commit/0de0b1b64a1c122254bb821ea0eb9b038875e8d4
)
>From what I understand (never wrote nor read any meaningful C++ nor looked in
the libreoffice codebase before).
Before this commit: it checked if a password have been submit, if that is the
case, then do something.
After this commit: it check if the document contains encrypted data, if that is
the case, then do something.
This change of behavior broke at least 1 use case:
Trying to open a non encrypted file using the API/uno while submitting a
password.
I tried to rewrote this part to fix this use-case:
```
// Also, ( maybe the new itemset contains new values, otherwise they will be
empty )
bool bPasswordProtected = true;
if (xMergedParams->HasItem(SID_ENCRYPTIONDATA))
{
const SfxUnoAnyItem* pEncryptionDataItem
= xMergedParams->GetItem<SfxUnoAnyItem>(SID_ENCRYPTIONDATA,
false);
if (pEncryptionDataItem)
{
uno::Sequence<beans::NamedValue> aEncryptionData;
pEncryptionDataItem->GetValue() >>= aEncryptionData;
for (const auto& rItem : std::as_const(aEncryptionData))
{
if (rItem.Name == "CryptoType")
{
OUString aValue;
rItem.Value >>= aValue;
if (aValue != "StrongEncryptionDataSpace")
{
// This is not just a password protected document.
Let's keep encryption data as is.
bPasswordProtected = false;
}
break;
}
}
}
}else if (xMergedParams->HasItem( SID_PASSWORD )){
bPasswordProtected = true;
}
if (bPasswordProtected){
// For password protected documents remove encryption data during
"Save as..."
xMergedParams->ClearItem(SID_PASSWORD);
xMergedParams->ClearItem(SID_ENCRYPTIONDATA);
}
```
(Basically, adding 1 "else if", and moving a block. Didn't sent a proper pull
request yet, probably later this week)
I recompiled and I confirm that with this modification it work for my usecase.
Between my previous comments and now I updated my test script and input file, I
will attach the new versions in this ticket.
The new command is
```
./remove_password.py
/home/user/qubes-app-linux-pdf-converter/tests/files_success/csv.tmp ''
```
("csv.tmp" is a standard csv file)
With the patch, the output is
```
libreoffice process
wait for socket
:file:///home/user/qubes-app-linux-pdf-converter/tests/files_success/csv.tmp:
```
, the process terminate within seconds and the file is correctly created.
Without the patch, the output is
```
libreoffice process
wait for socket
:file:///home/user/qubes-app-linux-pdf-converter/tests/files_success/csv.tmp:
```
, the process does not terminate (hang indefinitly), and when I send a "CTRL+C"
it display the following error "__main__.ErrorCodeIOException:
SfxBaseModel::impl_store
<file:///home/user/qubes-app-linux-pdf-converter/tests/files_success/csv.tmp.nopassword>
failed: 0x20d(Error Area:Io Class:General Code:13)
/home/user/core/sfx2/source/doc/sfxbasemodel.cxx:3153
"
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210315/8dff1b14/attachment-0001.htm>
More information about the Libreoffice-bugs
mailing list