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
This commit is contained in:
commit
310dc61ea3
3 changed files with 7 additions and 10 deletions
|
@ -209,14 +209,6 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
|
|||
|
||||
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
|
||||
{
|
||||
// Convert bitcoin:// to bitcoin:
|
||||
//
|
||||
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
|
||||
// which will lower-case it (and thus invalidate the address).
|
||||
if(uri.startsWith("bitcoin://", Qt::CaseInsensitive))
|
||||
{
|
||||
uri.replace(0, 10, "bitcoin:");
|
||||
}
|
||||
QUrl uriInstance(uri);
|
||||
return parseBitcoinURI(uriInstance, out);
|
||||
}
|
||||
|
|
|
@ -404,7 +404,12 @@ void PaymentServer::handleURIOrFile(const QString& s)
|
|||
return;
|
||||
}
|
||||
|
||||
if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
|
||||
if (s.startsWith("bitcoin://", Qt::CaseInsensitive))
|
||||
{
|
||||
Q_EMIT message(tr("URI handling"), tr("'bitcoin://' is not a valid URI. Use 'bitcoin:' instead."),
|
||||
CClientUIInterface::MSG_ERROR);
|
||||
}
|
||||
else if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
QUrl uri(s);
|
||||
|
|
|
@ -51,7 +51,7 @@ void URITests::uriTests()
|
|||
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
|
||||
QVERIFY(rv.label == QString());
|
||||
|
||||
QVERIFY(GUIUtil::parseBitcoinURI("bitcoin://175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address", &rv));
|
||||
QVERIFY(GUIUtil::parseBitcoinURI("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address", &rv));
|
||||
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
|
||||
QVERIFY(rv.label == QString());
|
||||
|
||||
|
|
Loading…
Reference in a new issue