ucb/source/ucp/webdav-curl/webdavcontent.cxx |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 57777bce551ffe4cf1292e05ec3fe7f8c92adb38
Author:     Giuseppe Castagno <[email protected]>
AuthorDate: Sun Aug 14 13:18:44 2016 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Nov 1 18:43:01 2021 +0100

    ucb: webdav-curl: tdf#101094 (23): Simplify cache removal: MOVE, COPY
    
    [ port of commit 63af1c52c534840d1f55e3041351d24b85edcaa4
      plus move Uris back into try block ]
    
    Change-Id: I8cc7f6e14fcac294531b5be8fdbaf78610a3adfc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123477
    Tested-by: Michael Stahl <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx 
b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index 5b1fbd5635e7..8917b749a537 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -2184,7 +2184,7 @@ uno::Any Content::open(
                                     ucb::IOErrorCode_NOT_EXISTING,
                                     aArgs ) ),
                             xEnv );
-                // Unreachable
+                        // Unreachable
                     }
                 }
                 catch ( DAVException const & e )
@@ -2640,12 +2640,12 @@ void Content::transfer(
         xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
     }
 
-    CurlUri sourceURI( rArgs.SourceURL );
-    CurlUri targetURI( xIdentifier->getContentIdentifier() );
-
     OUString aTargetURI;
     try
     {
+        CurlUri sourceURI( rArgs.SourceURL );
+        CurlUri targetURI( xIdentifier->getContentIdentifier() );
+
         aTargetURI = targetURI.GetPathBaseNameUnescaped();
 
         // Check source's and target's URL scheme
@@ -2765,13 +2765,13 @@ void Content::transfer(
             // destination resource.  If the Overwrite header is set to
             // "F" then the operation will fail.
 
+            aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+            aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
             aSourceAccess.MOVE( sourceURI.GetPath(),
                                 targetURI.GetURI(),
                                 rArgs.NameClash
                                     == ucb::NameClash::OVERWRITE,
                                 Environment );
-            aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-            aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 
             if ( xSource.is() )
             {
@@ -2794,13 +2794,13 @@ void Content::transfer(
             // destination resource.  If the Overwrite header is set to
             // "F" then the operation will fail.
 
+            aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+            aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
             aSourceAccess.COPY( sourceURI.GetPath(),
                                 targetURI.GetURI(),
                                 rArgs.NameClash
                                     == ucb::NameClash::OVERWRITE,
                                 Environment );
-            aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-            aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 
 // DAV resources store all additional props on server!
 //              // Copy own and all children's Additional Core Properties.
@@ -2820,14 +2820,10 @@ void Content::transfer(
     }
     catch ( ucb::IllegalIdentifierException const & )
     {
-        aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-        aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
         // queryContent
     }
     catch ( DAVException const & e )
     {
-        aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
-        aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
         // [RFC 2518] - WebDAV
         // 412 (Precondition Failed) - The server was unable to maintain
         // the liveness of the properties listed in the propertybehavior

Reply via email to