From 2aec5f3920d5ba9f7add67a1980e4321f5b7689b Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 31 May 2016 01:53:48 +0300 Subject: [PATCH] Check if DB pathname starts with the current directory --- m_librarian/db.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/m_librarian/db.py b/m_librarian/db.py index 0da18a4..56b194d 100755 --- a/m_librarian/db.py +++ b/m_librarian/db.py @@ -142,13 +142,13 @@ def open_db(db_uri=None): except: db_uri = find_sqlite_dburi() - if db_uri.startswith(os.sep) or os.altsep and db_uri.startswith(os.altsep) \ + if db_uri.startswith(os.sep) \ + or os.altsep and db_uri.startswith(os.altsep) \ or db_uri.startswith(os.pardir + os.sep) \ - or os.altsep and db_uri.startswith(os.pardir + os.altsep): - if db_uri.startswith(os.pardir + os.sep) \ - or os.altsep and db_uri.startswith(os.pardir + os.altsep): - db_uri = os.path.abspath(db_uri) - db_uri = 'sqlite://' + db_uri.replace(os.sep, '/') + or os.altsep and db_uri.startswith(os.pardir + os.altsep) \ + or db_uri.startswith(os.curdir + os.sep) \ + or os.altsep and db_uri.startswith(os.curdir + os.altsep): + db_uri = 'sqlite://' + os.path.abspath(db_uri).replace(os.sep, '/') sqlhub.processConnection = connection = connectionForURI(db_uri) -- 2.39.5