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 <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx
index d9f925b..6e0b57c 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