Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions qiita_core/configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def __init__(self):
def _get_main(self, config):
"""Get the configuration of the main section"""
self.test_environment = config.getboolean('main', 'TEST_ENVIRONMENT')
default_base_data_dir = join(dirname(abspath(__file__)),
'..', 'qiita_db', 'support_files',
install_dir = dirname(dirname(abspath(__file__)))
default_base_data_dir = join(install_dir, 'qiita_db', 'support_files',
'test_data')
self.base_data_dir = config.get('main', 'BASE_DATA_DIR') or \
default_base_data_dir
Expand Down
3 changes: 3 additions & 0 deletions qiita_db/support_files/patches/31.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- August 24, 2015
-- Delete all occurrences of '..' in the base_data_dir entry
SELECT 42;
11 changes: 11 additions & 0 deletions qiita_db/support_files/patches/python_patches/31.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from os.path import realpath
from qiita_db.sql_connection import TRN

with TRN:
TRN.add('SELECT base_data_dir FROM settings')
path = TRN.execute_fetchlast()

# if the path is non-canonical (it contains .. or other redundant symbols)
# this will update it, else it will leave as is
TRN.add("UPDATE settings SET base_data_dir = %s", (realpath(path),))
TRN.execute()