summaryrefslogtreecommitdiff
path: root/fpicker/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-11-22 16:38:29 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-11-23 12:07:03 +0100
commite4ff5b1fbabb538356053383a3491e3e986d1164 (patch)
tree0ca6172699f8723226a93de8bb8fc0da0d1179f4 /fpicker/source
parent014336e8d45fc192960b9240d362604577e78553 (diff)
tdf#145769 fpicker: RemoteFilesDialog: don't use FStatHelper
FStatHelper doesn't use an XCommandEnvironment and is thus unsuitable for remote access as it can't even authenticate with the password container; it should only be used for local access. Due to this problem, the ContentIsDocument() would always return a hard-coded "true" value from the webdav UCP, causing a spurious dialog that an existing file would be overwritten in Save Remote. (regression from 67fa088be7db1df661188ef4bab490a76fb06b85) Change-Id: Ibe667f2012e261b84d4c69c84fdd499b7276e64b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125666 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'fpicker/source')
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx26
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx2
2 files changed, 24 insertions, 4 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index b7efa8071116..dd4d4d32195a 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -22,7 +22,7 @@
#include <svtools/PlaceEditDialog.hxx>
#include <tools/debug.hxx>
#include <ucbhelper/commandenvironment.hxx>
-#include <svl/fstathelper.hxx>
+#include <unotools/ucbhelper.hxx>
#include <vcl/errinf.hxx>
#include <officecfg/Office/Common.hxx>
@@ -1140,12 +1140,32 @@ std::vector<OUString> RemoteFilesDialog::GetPathList() const
bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL )
{
- return FStatHelper::IsFolder(rURL);
+ try
+ {
+ ::ucbhelper::Content content(rURL,
+ ::utl::UCBContentHelper::getDefaultCommandEnvironment(),
+ m_xContext);
+ return content.isFolder();
+ }
+ catch (css::uno::Exception const&)
+ {
+ return false;
+ }
}
bool RemoteFilesDialog::ContentIsDocument( const OUString& rURL )
{
- return FStatHelper::IsDocument(rURL);
+ try
+ {
+ ::ucbhelper::Content content(rURL,
+ ::utl::UCBContentHelper::getDefaultCommandEnvironment(),
+ m_xContext);
+ return content.isDocument();
+ }
+ catch (css::uno::Exception const&)
+ {
+ return false;
+ }
}
sal_Int32 RemoteFilesDialog::getAvailableWidth()
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index 93a8e363f5b4..3dfb4e1dc9aa 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -68,7 +68,7 @@ public:
virtual const OUString& GetPath() override;
virtual std::vector<OUString> GetPathList() const override;
virtual bool ContentIsFolder( const OUString& rURL ) override;
- static bool ContentIsDocument(const OUString& rURL);
+ bool ContentIsDocument(const OUString& rURL);
virtual OUString getCurrentFileText() const override;
virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) override;