[Libreoffice-commits] core.git: sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Nov 10 13:18:40 UTC 2018


 sfx2/source/doc/docfile.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 603b63b4c154882ecfe95ae3c6960b08eb9fb626
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Nov 8 20:42:28 2018 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Nov 10 14:18:18 2018 +0100

    tdf#121288: ReplaceFile WinAPI doesn't play nicely with WebDAV mapped drives
    
    Change-Id: I0d7a64459de283dc10448e0086c66bedbf132553
    Reviewed-on: https://gerrit.libreoffice.org/63133
    Tested-by: Jenkins
    Reviewed-by: Gabor Kelemen <kelemeng at ubuntu.com>
    Tested-by: Gabor Kelemen <kelemeng at ubuntu.com>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 9e55c128bb71..61e92a3e0d5f 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -202,7 +202,7 @@ sal_uInt64 GetDefaultFileAttributes(const OUString& rURL)
 }
 
 /// Determines if rURL is safe to move or not.
-bool IsFileMovable(const OUString& rURL)
+bool IsFileMovable(const INetURLObject& rURL)
 {
 #ifdef MACOSX
     (void)rURL;
@@ -210,22 +210,25 @@ bool IsFileMovable(const OUString& rURL)
     return false;
 #else
 
-    if (!comphelper::isFileUrl(rURL))
+    if (rURL.GetProtocol() != INetProtocol::File)
         // Not a file:// URL.
         return false;
 
 #ifdef UNX
-    OUString rPath;
-    if (osl::FileBase::getSystemPathFromFileURL(rURL, rPath) != osl::FileBase::E_None)
+    OUString sPath = rURL.getFSysPath(FSysStyle::Unix);
+    if (sPath.isEmpty())
         return false;
 
     struct stat buf;
-    if (lstat(rPath.toUtf8().getStr(), &buf) != 0)
+    if (lstat(sPath.toUtf8().getStr(), &buf) != 0)
         return false;
 
     // Hardlink or symlink: osl::File::move() doesn't play with these nicely.
     if (buf.st_nlink > 1 || S_ISLNK(buf.st_mode))
         return false;
+#elif defined _WIN32
+    if (tools::IsMappedWebDAVPath(rURL))
+        return false;
 #endif
 
     return true;
@@ -1845,7 +1848,7 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
                 OUString aDestMainURL = aDest.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 
                 sal_uInt64 nAttributes = GetDefaultFileAttributes(aDestMainURL);
-                if (IsFileMovable(aDestMainURL)
+                if (IsFileMovable(aDest)
                     && osl::File::replace(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None)
                 {
                     if (nAttributes)


More information about the Libreoffice-commits mailing list