summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2015-12-04 17:10:06 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-12-15 19:26:00 +0000
commit522de0352ae5968d4f24726812504a2749ad0958 (patch)
treeb08e279ed5819180e113cce7604ea208d4381ab0 /sfx2
parentc3d24d6416556ea6d583f08ba6aef916ba972096 (diff)
tdf#95792: fix saving file the first time on some WebDAV servers.
Some WebDAV servers don't implement section 7.3 of RFC4918: <http://tools.ietf.org/html/rfc4918#section-7.3> This lack of implementation breaks 'Save As...' functionality when the target is a WebDAV server, by not locking the URL ('reserve the name for use', in RFC4918 parlance). The server not implementing this usually answers with one of '405 Method Not Allowed', '501 Not Implemented' or '412 Precondition Failed' http error codes. The fix should manage this lack of implementation. Change-Id: Ie4689a076aafa365106d02b3ea16459a28fcde65 Reviewed-on: https://gerrit.libreoffice.org/20600 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 4c82edfb3a9286a0bfef3f006e468e5c331987eb) Reviewed-on: https://gerrit.libreoffice.org/20722 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/docfile.cxx30
1 files changed, 28 insertions, 2 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 94633e6d5873..a9a5df0633e7 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2083,11 +2083,37 @@ void SfxMedium::Transfer_Impl()
sComment = pComments->GetValue( );
}
OUString sResultURL;
- if (!aTransferContent.transferContent( aSourceContent, eOperation,
- aFileName, nNameClash, aMimeType, bMajor, sComment, &sResultURL, sObjectId))
+ bool isTransferOK = aTransferContent.transferContent(
+ aSourceContent, eOperation,
+ aFileName, nNameClash, aMimeType, bMajor, sComment,
+ &sResultURL, sObjectId );
+
+ if ( !isTransferOK )
pImp->m_eError = ERRCODE_IO_GENERAL;
else if ( !sResultURL.isEmpty( ) ) // Likely to happen only for checkin
SwitchDocumentToFile( sResultURL );
+ try
+ {
+ if ( GetURLObject().isAnyKnownWebDAVScheme() &&
+ isTransferOK &&
+ eOperation == ::ucbhelper::InsertOperation_COPY )
+ {
+ // tdf#95272 try to re-issue a lock command when a new file is created.
+ // This may be needed because some WebDAV servers fail to implement the
+ // 'LOCK on unallocated reference', see issue comment:
+ // <https://bugs.documentfoundation.org/show_bug.cgi?id=95792#c8>
+ // and specification at:
+ // <http://tools.ietf.org/html/rfc4918#section-7.3>
+ // If the WebDAV resource is already locked by this LO instance, nothing will
+ // happen, e.g. the LOCK method will not be sent to the server.
+ ::ucbhelper::Content aLockContent = ::ucbhelper::Content( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() );
+ aLockContent.lock();
+ }
+ }
+ catch ( css::uno::Exception & e )
+ {
+ SAL_WARN( "sfx.doc", "LOCK not working while re-issuing it. Exception message: " << e.Message );
+ }
}
catch ( const css::ucb::CommandAbortedException& )
{