-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Do additional character escaping for wallet names and address labels #16826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK ba9f82a for the ampersand issue. I don't know how to test the send coins dialog issue. The code looks fine.
@@ -375,6 +375,8 @@ void BitcoinGUI::createActions() | |||
for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) { | |||
const std::string& path = i.first; | |||
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path); | |||
// Menu items remove single &. Single & are shown when && is in the string, but only the first occurrence. So replace only the first & with && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: long comment; perhaps split it over 2 lines if you have to retouch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appended the change to cad3ab5 while rebasing.
ACK ba9f82a |
First ampersand is removed because it is used to specify hot key. Replacing it with "&&" is recommended method. https://doc.qt.io/qt-5/qmenubar.html#details |
Make a wallet named like When you are on the send page, set a label for the recipient in the same way that the wallet name was set. Then check the send coins dialog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ba9f82a (tested both cases with and without these changes)
Thanks @achow101. |
ACK ba9f82a, I have reviewed the code and manually tested these changes, and agree they can be merged. Additional test to my previous manual testing, with send label supplied as On master:
This PR:
|
@kristapsk good catch, reproduced your issue. |
ba9f82a
to
ad52f05
Compare
Fixed the escaping in the close dialog. Also noticed that notifications needed HTML escaping too, so I've added escapes for the wallet name and address label in transaction notifications. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Tested close wallet dialog, is ok now. |
@@ -75,7 +75,7 @@ void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent) | |||
{ | |||
QMessageBox box(parent); | |||
box.setWindowTitle(tr("Close wallet")); | |||
box.setText(tr("Are you sure you wish to close wallet <i>%1</i>?").arg(wallet_model->getDisplayName())); | |||
box.setText(tr("Are you sure you wish to close wallet <i>%1</i>?").arg(GUIUtil::HtmlEscape(wallet_model->getDisplayName()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re DrahtBot: this PR and #16822 both touch this one line. Trivial rebase for the whichever is not merged first.
Untested ACK, thanks for adding proper escaping, ad52f05 |
…ddress labels ad52f05 Escape ampersands (&) in wallet names in Open Wallet menu (Andrew Chow) 2c530ea HTML escape address labels in more dialogs and notifications (Andrew Chow) 1770a97 HTML escape the wallet name in more dialogs and notifications (Andrew Chow) Pull request description: Fixes some places where wallet names and address labels which contain valid html or other interpreted characters are displayed incorrectly. In the send coins dialog, if the wallet name or the address label contains valid html, then the html would be shown rather than the literal string for the wallet name or label. This PR fixes that so the true name or label is shown. The Open Wallet menu would incorrectly show wallet names with ampersands (`&`). For some reason, Qt removes the first ampersand in a string. So by replacing the first ampersand with 2 ampersands, the correct number of ampersands will be shown. Fixes the HTML escaping issues in #16820 ACKs for top commit: laanwj: Untested ACK, thanks for adding proper escaping, ad52f05 fanquake: ACK ad52f05 Tree-SHA512: 264bef28a8061c7f43cc30c3e04b361c614ea78b9915e8763c44553c8967131b066db500977fa6130de1f8874b9bba59e630486c58e1e3c5c165555105a6c254
cad3ab5 gui: fix autofocus in CreateWalletActivity::askPassphrase() (Jon Atack) 539d940 gui: fix passphrase labels/tooltip in createwalletdialog/askpassphrasedialog (Jon Atack) 43aa9b0 gui: rename encrypt(), blank(), and askPasshprase() (Jon Atack) Pull request description: Closes bitcoin#16820. The wallet [name escaping issue](bitcoin#15450 (review)) in that issue predates bitcoin#15450 and is fixed by bitcoin#16826. - [x] rename encrypt() to encryptWallet(), and blank() to makeBlankWallet() // EDIT: updated to isEncryptWalletChecked() isDisablePrivateKeysChecked() isMakeBlankWalletChecked() - [x] fix naming of askPasshprase() to askPassphrase() - [x] fix passphrase labels and tooltip in createwalletdialog.ui and askpassphrasedialog.ui - [x] fix grammar of labels in askpassphrase dialog and WalletController::closeWallet - [x] fix autofocus in CreateWalletActivity::askPassphrase() Squashed down to three commits. Reviewers, to test manually: build, launch the gui wallet, and look at labels/tooltips/focus with the create wallet, encrypt wallet, change password, and close wallet commands. ACKs for top commit: jb55: Approach ACK cad3ab5 instagibbs: code review and tACK cad3ab5 fanquake: ACK cad3ab5 Tree-SHA512: b441fbf8f8cd370dd692bac24f0d3c1b32fc7d947b6c3a2c9ba7cf0bc175a72b3460440f2f10f7632c0e8e0f8e65fe15615a30c46e2c7763bf258c504b457dd6
cad3ab5 gui: fix autofocus in CreateWalletActivity::askPassphrase() (Jon Atack) 539d940 gui: fix passphrase labels/tooltip in createwalletdialog/askpassphrasedialog (Jon Atack) 43aa9b0 gui: rename encrypt(), blank(), and askPasshprase() (Jon Atack) Pull request description: Closes bitcoin#16820. The wallet [name escaping issue](bitcoin#15450 (review)) in that issue predates bitcoin#15450 and is fixed by bitcoin#16826. - [x] rename encrypt() to encryptWallet(), and blank() to makeBlankWallet() // EDIT: updated to isEncryptWalletChecked() isDisablePrivateKeysChecked() isMakeBlankWalletChecked() - [x] fix naming of askPasshprase() to askPassphrase() - [x] fix passphrase labels and tooltip in createwalletdialog.ui and askpassphrasedialog.ui - [x] fix grammar of labels in askpassphrase dialog and WalletController::closeWallet - [x] fix autofocus in CreateWalletActivity::askPassphrase() Squashed down to three commits. Reviewers, to test manually: build, launch the gui wallet, and look at labels/tooltips/focus with the create wallet, encrypt wallet, change password, and close wallet commands. ACKs for top commit: jb55: Approach ACK cad3ab5 instagibbs: code review and tACK cad3ab5 fanquake: ACK cad3ab5 Tree-SHA512: b441fbf8f8cd370dd692bac24f0d3c1b32fc7d947b6c3a2c9ba7cf0bc175a72b3460440f2f10f7632c0e8e0f8e65fe15615a30c46e2c7763bf258c504b457dd6
Github-Pull: bitcoin#16826 Rebased-From: 1770a97
Github-Pull: bitcoin#16826 Rebased-From: 2c530ea
Github-Pull: bitcoin#16826 Rebased-From: ad52f05
Github-Pull: bitcoin#16826 Rebased-From: 1770a97
Github-Pull: bitcoin#16826 Rebased-From: 2c530ea
Github-Pull: bitcoin#16826 Rebased-From: ad52f05
Summary: Qt interprets HTML and uses the first ampersand in a string to specify hot key. Escape HTML and ampersands in wallet names to display them unambigously. Backport of Core [[bitcoin/bitcoin#16826 | PR16826]] Test Plan: `ninja && ninja check` Run `bitcoin-qt` and create a new wallet called "Hel&lo <b>World</b>, and make sure it is display as a raw string everywhere (send transaction dialog, Open Wallet menu) Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7931
…s and address labels
…s and address labels
…s and address labels
Fixes some places where wallet names and address labels which contain valid html or other interpreted characters are displayed incorrectly.
In the send coins dialog, if the wallet name or the address label contains valid html, then the html would be shown rather than the literal string for the wallet name or label. This PR fixes that so the true name or label is shown.
The Open Wallet menu would incorrectly show wallet names with ampersands (
&
). For some reason, Qt removes the first ampersand in a string. So by replacing the first ampersand with 2 ampersands, the correct number of ampersands will be shown.Fixes the HTML escaping issues in #16820