sfx2/source/doc/docfile.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
New commits: commit f0388c306edfce91241d59420e96a5b2b1c939f5 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Nov 8 20:42:28 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Nov 17 17:53:08 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 <kelem...@ubuntu.com> Tested-by: Gabor Kelemen <kelem...@ubuntu.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 603b63b4c154882ecfe95ae3c6960b08eb9fb626) Reviewed-on: https://gerrit.libreoffice.org/63286 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits