tools/qa/cppunit/test_urlobj.cxx |    9 +++++++++
 tools/source/fsys/urlobj.cxx     |    3 +++
 2 files changed, 12 insertions(+)

New commits:
commit efa20d38fa51675e738ce50d6894b5df75debea0
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Dec 24 09:35:44 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Dec 24 18:21:34 2021 +0100

    tdf#146382 cant open file from Explorer-attached remote location
    
    problem spotted by mikekaganski
    
    regression from
        commit 0b46361ef84a61100a0274a007062317607d097a
        Author: Noel Grandin <n...@peralex.com>
        Date:   Sat Nov 20 08:03:49 2021 +0200
        tdf#133835 speedup calc autofilter (4)
    
    where I changed the behaviour of parseHostOrNetBiosName from overwriting
    the destination buffer to appending to it.
    
    Change-Id: I1bd3c7eade035a867c026364f5e114c1e652ca32
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127352
    Tested-by: Gabor Kelemen <kelem...@ubuntu.com>
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 15bc492281111997a5da556961b923bb607642b6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127381

diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index a335701c5cab..ec64b5d66777 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -311,6 +311,14 @@ namespace tools_urlobj
                 obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
         }
 
+        void testTd146382() {
+            INetURLObject 
obj("file://share.allotropia.de@SSL/DavWWWRoot/remote.php");
+            CPPUNIT_ASSERT(!obj.HasError());
+            CPPUNIT_ASSERT_EQUAL(
+                
OUString("file://share.allotropia.de@SSL/DavWWWRoot/remote.php"),
+                obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+        }
+
         // Change the following lines only, if you add, remove or rename
         // member functions of the current class,
         // because these macros are need by auto register mechanism.
@@ -326,6 +334,7 @@ namespace tools_urlobj
         CPPUNIT_TEST( testSetName );
         CPPUNIT_TEST( testSetExtension );
         CPPUNIT_TEST( testChangeScheme );
+        CPPUNIT_TEST( testTd146382 );
         CPPUNIT_TEST_SUITE_END(  );
     };                          // class createPool
 
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 8c3d2845eab2..7b86fe0f5261 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -2880,7 +2880,10 @@ bool INetURLObject::parseHostOrNetBiosName(
                     }
                 }
                 if (pCanonic)
+                {
+                    pCanonic->setLength(nOriginalCanonicLength);
                     pCanonic->append(buf);
+                }
             }
             else
             {

Reply via email to