- important for the open URI dialog to give users feedback when a file is invalid etc.
[Qt] add messages when handling local payment request files #3374
pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:Qt_local-payment-request-file changing 2 files +37 −17-
Diapolo commented at 10:21 AM on December 9, 2013: none
-
laanwj commented at 11:18 AM on December 9, 2013: member
I tested it when I did the pull for the "Open URI" dialog and
file:handling was already working. The current URI code handles file: URIs transparently. Why so much extra code? -
Diapolo commented at 11:39 AM on December 9, 2013: none
I have no idea, why it was working then ;). But try to chose an invalid file, current master doesn't show any warning or error. You are creating a bitcoin: URI with local file sheme in your dialog, that needs to be converted back so we can directly access the file and don't need any fetching via network.
-
laanwj commented at 11:42 AM on December 9, 2013: member
It doesn't do any "Fetching via network" when you specify a
file:URI. The Qt URI handling code recognizesfile:URIs and handles them transparently, as it should.Better error reporting is nice but wouldn't this be possible without having to do manual parsing on them?
-
Diapolo commented at 12:18 PM on December 9, 2013: none
@laanwj Take a loot at the code, in
handleURIOrFile()we are reachingfetchRequest()for files selected via the URI dialog, which are then going to be processed. This is avoided by my code, because it skipsfetchRequest()for local file sheme in an URI. @TheBlueMatt Which Qt version has @BitcoinPullTester?QUrl::isLocalFile()was introduced with Qt 4.8, which seems missing and that is causing the error. -
Diapolo commented at 1:45 PM on December 9, 2013: none
I verified that indeed the
file:is handled by our code, but by the networking code path.I have 2 suggestions:
- Do it my way, and prevent
fetchRequest()andnetRequestFinished(), as local pr-files shouldn't take the network processing code flow IMHO. - Rework the open URI dialog to don't generate a bitcoin: URI for a local file but directly call
handleURIOrFile()with a filename passed instead an URI.
- Do it my way, and prevent
-
laanwj commented at 1:53 PM on December 9, 2013: member
I would really like to keep it this way and handle files through the normal code path for URIs. I don't want to add a special exception for files if it works fine like this.
If you want to add better error handling that's good, but please find a way to fit it in the current mechanism (with the added bonus that it works for all URIs and not a subset).
Unnecessary complexity only makes it harder to test and understand code.
-
Diapolo commented at 3:38 PM on December 9, 2013: none
Seems we have once more a @BitcoinPullTester problem ;).
-
bd70562f66
[Qt] add messages when handling local payment request files
- important for the open URI dialog to give users feedback when a file is invalid etc.
-
in src/qt/paymentserver.cpp:None in bd70562f66
379 | QByteArray temp; 380 | temp.append(uri.queryItemValue("r")); 381 | QString decoded = QUrl::fromPercentEncoding(temp); 382 | QUrl fetchUrl(decoded, QUrl::StrictMode); 383 | 384 | - qDebug() << "PaymentServer::handleURIOrFile : fetchRequest(" << fetchUrl << ")";
laanwj commented at 10:48 AM on December 10, 2013:Hm why not just always log this? That the URI might be invalid doesn't mean it didn't go into fetchRequest(...).
Diapolo commented at 10:51 AM on December 10, 2013:fetchRequest()is only called, if the URL is valid?
laanwj commented at 11:11 AM on December 10, 2013:Ok right
BitcoinPullTester commented at 10:50 AM on December 10, 2013: noneAutomatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/bd70562f660552973dcf99e00c7897ae884661da for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
laanwj commented at 9:06 AM on December 16, 2013: memberNo, nothing to add, the code changes look fine.
Do you have suggestions on how to test the new messages?
Diapolo commented at 10:15 AM on December 16, 2013: noneTry to open an invalid file via Open URI dialog or via webserver (bitcoin: URI). The others should be more uncommon, as an invalid URI check is likely to rarely get into handleUriOrFile(). The error in the
if (QFile::exists(s))check can only happen on Mac, because this works with files AFAIK. @laanwj Did you verify it's reporting errors now?laanwj commented at 8:06 AM on January 9, 2014: memberI just pulled from Transifex, that's unaffected by any changes in the repository except the en master file which I didn't touch...
laanwj referenced this in commit f126973fd0 on Jan 13, 2014laanwj merged this on Jan 13, 2014laanwj closed this on Jan 13, 2014Diapolo deleted the branch on Jan 14, 2014Bushstar referenced this in commit 4e8f4ea202 on Apr 8, 2020DrahtBot locked this on Sep 8, 2021Contributors
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:16 UTC
More mirrored repositories can be found on mirror.b10c.me