[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - dbaccess/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 13 09:14:02 UTC 2019


 dbaccess/source/core/misc/dsntypes.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 3ddccc28c0893ded5a31e1c1d023af22f6ec160f
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sun May 19 21:08:52 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 13 11:13:29 2019 +0200

    tdf#125381: Manage URLs beginning with an "~" in cutPrefix (dbaccess/dsntypes)
    
    On Windows or with other renderings than gtk3, the urls may begin with an ~
    In this case, cutPrefix returns only empty string
    When trying to access Index management for odb files related to dBase
    indexes don't display because cutPrefix returns empty url
    in dbaccess/source/ui/dlg/detailpages.cxx line 200
    
    198         ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : nullptr;
    199         if (pTypeCollection && pUrlItem && pUrlItem->GetValue().getLength())
    200             m_sDsn = pTypeCollection->cutPrefix(pUrlItem->GetValue());
    
    Change-Id: I47360e205ddea7b060a31da697bbe9857ad3f4c0
    Reviewed-on: https://gerrit.libreoffice.org/72568
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    (cherry picked from commit d34ed0008f12cfe47dd239672f1941f3c54d97fd)
    Reviewed-on: https://gerrit.libreoffice.org/73709
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    (cherry picked from commit 27bd20cf5333a5df29286794b7384520fbc55012)
    Reviewed-on: https://gerrit.libreoffice.org/73876

diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index aeca5a029655..8e88bb586c6c 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -84,17 +84,20 @@ OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
     OUString sRet;
     OUString sOldPattern;
 
+    // on Windows or with gen rendering, the urls may begin with an ~
+    const OUString& sCleanURL = comphelper::string::stripStart(_sURL, '~');
+
     for (auto const& dsnPrefix : m_aDsnPrefixes)
     {
         WildCard aWildCard(dsnPrefix);
-        if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
+        if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(sCleanURL) )
         {
             // This relies on the fact that all patterns are of the form
             //   foo*
             // that is, the very concept of "prefix" applies.
             OUString prefix(comphelper::string::stripEnd(dsnPrefix, '*'));
-            OSL_ENSURE(prefix.getLength() <= _sURL.getLength(), "How can A match B when A shorter than B?");
-            sRet = _sURL.copy(prefix.getLength());
+            OSL_ENSURE(prefix.getLength() <= sCleanURL.getLength(), "How can A match B when A shorter than B?");
+            sRet = sCleanURL.copy(prefix.getLength());
             sOldPattern = dsnPrefix;
         }
     }


More information about the Libreoffice-commits mailing list