ucb/source/ucp/webdav-curl/webdavcontent.cxx |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

New commits:
commit dbe4b01ca7d0069f45d655c04ca595b42b71c631
Author:     Giuseppe Castagno <[email protected]>
AuthorDate: Wed Jan 27 17:35:36 2016 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Nov 1 18:39:26 2021 +0100

    ucb: webdav-curl: tdf#101094 (16) OPTIONS: Options cache removal: MOVE
    
    [ port of commit 2359e5a002f4df58548803320991064e6a6d968c ]
    
    Change-Id: I27a68855198fe220a1f4141bb89673992c12e1f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123468
    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 d9f925b2151d..6e0b57cb5b01 100644
--- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
@@ -1936,14 +1936,18 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
             = new ::ucbhelper::ContentIdentifier( aNewURL );
         uno::Reference< ucb::XContentIdentifier > xOldId = xIdentifier;
 
+        CurlUri const sourceURI( xOldId->getContentIdentifier() );
+        CurlUri targetURI( xNewId->getContentIdentifier() );
+
         try
         {
-            CurlUri const sourceURI( xOldId->getContentIdentifier() );
-            CurlUri targetURI( xNewId->getContentIdentifier() );
             targetURI.SetScheme( sourceURI.GetScheme() );
 
             xResAccess->MOVE(
                 sourceURI.GetPath(), targetURI.GetURI(), false, xEnv );
+            aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+            aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
+
             // @@@ Should check for resources that could not be moved
             //     (due to source access or target overwrite) and send
             //     this information through the interaction handler.
@@ -1977,6 +1981,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
         }
         catch ( DAVException const & e )
         {
+            aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+            aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
             // Do not set new title!
             aNewTitle.clear();
 
@@ -2592,11 +2598,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
@@ -2721,6 +2728,8 @@ void Content::transfer(
                                 rArgs.NameClash
                                     == ucb::NameClash::OVERWRITE,
                                 Environment );
+            aStaticDAVOptionsCache.removeDAVOptions( sourceURI.GetURI() );
+            aStaticDAVOptionsCache.removeDAVOptions( targetURI.GetURI() );
 
             if ( xSource.is() )
             {
@@ -2767,10 +2776,14 @@ 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