bool parseBitcoinURI(QString uri, SendCoinsRecipient *out) case sensitivity and space trimming #1460

issue xanatos opened this issue on June 14, 2012
  1. xanatos commented at 7:04 AM on June 14, 2012: none

    From guiutil.cpp

    if(uri.startsWith("bitcoin://"))
    {
        uri.replace(0, 10, "bitcoin:");
    }
    

    (where uri is a QString)

    now, the test is quite wrong. First it is a case sensitive test, but scheme names in URI are case insensitive (so BITCOIN:// is the same as bitcoin://). It should be uri.startsWith("bitcoin://", Qt::CaseInsensitive).

    Second (but this I haven't tested), if QUrl works as other url parsers it trims the string before parsing it, so "\n\r\t bitcoin://something" is the same as "bitcoin://something", so a

    uri.trimmed();
    

    before the if wouldn't probably be bad (but note that uri.trimmed()).

  2. laanwj commented at 7:30 AM on June 14, 2012: member

    Well it's not wrong, it handles the most common case of "broken" bitcoin URLs and does one final try to fix it (See https://en.bitcoin.it/wiki/BIP_0021 , bitcoin:// is wrong syntax). Sure, it could be extended, but it was never intended to be watertight.

  3. laanwj commented at 7:31 AM on June 14, 2012: member

    But if you submit this as a pull request I'll merge it.

  4. Diapolo commented at 5:33 PM on June 14, 2012: none

    Tried this with Firefox, which converts an uppercase HTTP into a lowercase http while typing.

  5. laanwj referenced this in commit b3e579713f on Nov 12, 2013
  6. laanwj closed this on Nov 12, 2013

  7. MathyV referenced this in commit a8c1a29d09 on Aug 4, 2014
  8. MathyV referenced this in commit ce5662f491 on Aug 5, 2014
  9. suprnurd referenced this in commit c4fe229008 on Dec 5, 2017
  10. lateminer referenced this in commit 268a41fc6c on Jan 22, 2019
  11. lateminer referenced this in commit 18fa545831 on May 6, 2020
  12. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

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-13 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me