Skip to content

BitcoinQT downcases bitcoin://... address on OSX #11645

@Sjors

Description

@Sjors

When entering bitcoin://1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX in the Safari address bar, it opens BitcoinQT, but then says:

invalid

Dev hint: try RCDefault in order to make OSX open these links using a custom build.

Tested with v0.15.1rc1 as well as master. Using QT 5.8.0.

This doesn't happen when I start QT from the command line:
Bitcoin-Qt bitcoin://1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX

It does happen if I use:
open bitcoin://1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX

So it's not a Safari issue.

Using log statements I found that this downcase happens somewhere before bool parseBitcoinURI in guiutil.cpp. This function actually strips // from the URI because:

//    Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,

See also #854.

This function is called from PaymentServer::handleURIOrFile in paymentserver.cpp.

Before that bool PaymentServer::eventFilter uses:

      QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event);
      ...
          handleURIOrFile(fileEvent->url().toString());

Lower case already happened here.

If I use a single slash, there's no downcase, altough the UI then complains about the initial slash.

So perhaps something changed in QT and we need to do this earlier. Or it's OSX that's broken.

This does behave, suggesting that indeed something is treating the address as a host name:
open bitcoin:1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX

QT documentation for QUrl suggests this is expected behavior:

Note that the case folding rules in Nameprep, which QUrl conforms to, require host names to always be converted to lower case, regardless of the Qt::FormattingOptions used.

That remark has been in their documentation more or less forever.

I can't find a workaround, unless there's some way to get additional information out of QFileOpenEvent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions