Skip to content

Commit 310dc61

Browse files
committed
Merge #12723: Qt5: Warning users about invalid-BIP21 URI bitcoin://
b7fbcc5 Qt: Warn users about invalid-BIP21 URI bitcoin:// (Alexey Ivanov) Pull request description: This change affects only Qt5 users, since Qt4 QUrl don't forces lower case for urls. Also bitcoin-qt builds against Qt4 on linux. PR for #11645 Tree-SHA512: 6b8cb18b29dbd2754e190a662ed67274a7f0decc6adb00b7e1af107d5f8ea2845b668cf28d6ccf2f1d15e8ef212f5a76910810634a4c15e7fabd1dd2072e7232
2 parents 4ad3b3c + b7fbcc5 commit 310dc61

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/qt/guiutil.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,6 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
209209

210210
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
211211
{
212-
// Convert bitcoin:// to bitcoin:
213-
//
214-
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
215-
// which will lower-case it (and thus invalidate the address).
216-
if(uri.startsWith("bitcoin://", Qt::CaseInsensitive))
217-
{
218-
uri.replace(0, 10, "bitcoin:");
219-
}
220212
QUrl uriInstance(uri);
221213
return parseBitcoinURI(uriInstance, out);
222214
}

src/qt/paymentserver.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,12 @@ void PaymentServer::handleURIOrFile(const QString& s)
404404
return;
405405
}
406406

407-
if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
407+
if (s.startsWith("bitcoin://", Qt::CaseInsensitive))
408+
{
409+
Q_EMIT message(tr("URI handling"), tr("'bitcoin://' is not a valid URI. Use 'bitcoin:' instead."),
410+
CClientUIInterface::MSG_ERROR);
411+
}
412+
else if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
408413
{
409414
#if QT_VERSION < 0x050000
410415
QUrl uri(s);

src/qt/test/uritests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void URITests::uriTests()
5151
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
5252
QVERIFY(rv.label == QString());
5353

54-
QVERIFY(GUIUtil::parseBitcoinURI("bitcoin://175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address", &rv));
54+
QVERIFY(GUIUtil::parseBitcoinURI("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address", &rv));
5555
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
5656
QVERIFY(rv.label == QString());
5757

0 commit comments

Comments
 (0)