diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-08 20:42:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-11-17 17:53:08 +0100 |
commit | f0388c306edfce91241d59420e96a5b2b1c939f5 (patch) | |
tree | 378c5cdfd1a2ad7ab5009e6751aa90d82cb6e281 /sfx2 | |
parent | 3478c3d40b06163816e15f63cf71892cfae9f868 (diff) |
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@ubuntu.com>
Tested-by: Gabor Kelemen <kelemeng@ubuntu.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 603b63b4c154882ecfe95ae3c6960b08eb9fb626)
Reviewed-on: https://gerrit.libreoffice.org/63286
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index e101aa2e815d..11d6fc293301 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -200,7 +200,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; @@ -208,22 +208,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; @@ -1860,7 +1863,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) |