Qt wizard: bugfix: standardize_path in WCWalletName
without this, any wallet that is not in the config wallet_path cannot be open.
This commit is contained in:
@@ -17,7 +17,7 @@ from electrum.keystore import bip44_derivation, bip39_to_seed, purpose48_derivat
|
|||||||
from electrum.plugin import run_hook, HardwarePluginLibraryUnavailable
|
from electrum.plugin import run_hook, HardwarePluginLibraryUnavailable
|
||||||
from electrum.storage import StorageReadWriteError
|
from electrum.storage import StorageReadWriteError
|
||||||
from electrum.util import WalletFileException, get_new_wallet_name, UserFacingException, InvalidPassword
|
from electrum.util import WalletFileException, get_new_wallet_name, UserFacingException, InvalidPassword
|
||||||
from electrum.util import is_subpath, ChoiceItem, multisig_type, UserCancelled
|
from electrum.util import is_subpath, ChoiceItem, multisig_type, UserCancelled, standardize_path
|
||||||
from electrum.wallet import wallet_types
|
from electrum.wallet import wallet_types
|
||||||
from .wizard import QEAbstractWizard, WizardComponent
|
from .wizard import QEAbstractWizard, WizardComponent
|
||||||
from electrum.logging import get_logger, Logger
|
from electrum.logging import get_logger, Logger
|
||||||
@@ -92,7 +92,7 @@ class QENewWalletWizard(NewWalletWizard, QEAbstractWizard, MessageBoxMixin):
|
|||||||
QEAbstractWizard.__init__(self, config, app, start_viewstate=start_viewstate)
|
QEAbstractWizard.__init__(self, config, app, start_viewstate=start_viewstate)
|
||||||
self.window_title = _('Create/Restore wallet')
|
self.window_title = _('Create/Restore wallet')
|
||||||
|
|
||||||
self._path = path
|
self._path = standardize_path(path)
|
||||||
self._password = None
|
self._password = None
|
||||||
|
|
||||||
# attach gui classes to views
|
# attach gui classes to views
|
||||||
@@ -299,16 +299,17 @@ class WCWalletName(WalletWizardComponent, Logger):
|
|||||||
if _path:
|
if _path:
|
||||||
self.name_e.setText(relative_path(_path))
|
self.name_e.setText(relative_path(_path))
|
||||||
|
|
||||||
def on_filename(filename):
|
def on_filename(filename_or_path):
|
||||||
# FIXME? "filename" might contain ".." (etc) and hence sketchy path traversals are possible
|
# Note: "filename" might contain ".." (etc) and hence sketchy path traversals are possible
|
||||||
nonlocal temp_storage
|
nonlocal temp_storage
|
||||||
temp_storage = None
|
temp_storage = None
|
||||||
msg = None
|
msg = None
|
||||||
self.wallet_exists = False
|
self.wallet_exists = False
|
||||||
self.wallet_is_open = False
|
self.wallet_is_open = False
|
||||||
self.wallet_needs_hw_unlock = False
|
self.wallet_needs_hw_unlock = False
|
||||||
if filename:
|
if filename_or_path:
|
||||||
_path = os.path.join(datadir_wallet_folder, filename)
|
# Note: if filename_or_path is a path, os.path.join will leave it unchanged
|
||||||
|
_path = os.path.join(datadir_wallet_folder, filename_or_path)
|
||||||
wallet_from_memory = self.wizard._daemon.get_wallet(_path)
|
wallet_from_memory = self.wizard._daemon.get_wallet(_path)
|
||||||
try:
|
try:
|
||||||
if wallet_from_memory:
|
if wallet_from_memory:
|
||||||
@@ -345,7 +346,7 @@ class WCWalletName(WalletWizardComponent, Logger):
|
|||||||
+ _("Press 'Finish' to create/focus window.")
|
+ _("Press 'Finish' to create/focus window.")
|
||||||
if msg is None:
|
if msg is None:
|
||||||
msg = _('Cannot read file')
|
msg = _('Cannot read file')
|
||||||
if filename and os.path.isabs(relative_path(_path)):
|
if filename_or_path and os.path.isabs(relative_path(_path)):
|
||||||
outside_text = _('Note: this wallet file is outside the default wallets folder.')
|
outside_text = _('Note: this wallet file is outside the default wallets folder.')
|
||||||
else:
|
else:
|
||||||
outside_text = ''
|
outside_text = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user