<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - storeAsURL regression between libreoffice < 7 and libreoffice >=7"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=137926#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - storeAsURL regression between libreoffice < 7 and libreoffice >=7"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=137926">bug 137926</a>
from <span class="vcard"><a class="email" href="mailto:libreoffice@neowutran.ovh" title="libreoffice@neowutran.ovh">libreoffice@neowutran.ovh</a>
</span></b>
<pre>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
( <a href="https://gerrit.libreoffice.org/c/core/+/104345">https://gerrit.libreoffice.org/c/core/+/104345</a> /
<a href="https://github.com/LibreOffice/core/commit/0de0b1b64a1c122254bb821ea0eb9b038875e8d4">https://github.com/LibreOffice/core/commit/0de0b1b64a1c122254bb821ea0eb9b038875e8d4</a>
)
>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
"</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>