[Interest] bug with # in URL when using setUrl?

Larry Martell larry.martell at gmail.com
Tue Mar 15 12:04:49 CET 2016


On Tue, Mar 15, 2016 at 1:32 AM, Thiago Macieira
<thiago.macieira at intel.com> wrote:
> On segunda-feira, 14 de março de 2016 18:30:13 PDT Larry Martell wrote:
>> We have an app that emits a URL with a hashtag in it (#) and that is
>> processed by some Angular JS code we have
>> (https://docs.angularjs.org/guide/$location). That URL is emitted with
>> setUrl. It works fine on a Mac, but on Windows it acts as if the #
>> were not there. Googling I found this:
>>
>> https://bugreports.qt.io/browse/QTWEBKIT-56
>>
>> Does anyone know if this bug could be the issue I am facing?
>
> "Emits a URL" isn't enough information, so I'm going to make some assumptions.
> I'm assuming that you're emitting a signal that has a QUrl parameter and the
> URL it carries contains a fragment (that is, it has a #). In the slot, you
> process the URL.

Sorry for not giving more details. It's not a fragment - it's an
Angular JS routing thing (https://docs.angularjs.org/guide/$location,
http://stackoverflow.com/questions/14319967/angularjs-routing-without-the-hash).
I don't really understand all that, as I didn't write this code, I
just inherited it and have to support it.

The code is something like this:

    QString urlStr = "http://foo.bar.com:8000/#/workitem/12345";
    QUrl reportUrl(urlStr);

Then it emits a signal, which has that QUrl parameter which causes
this code to run:

  ui->webView->setUrl(url);

The Angular JS intercepts that URL and based on the # it does some
mapping to it.

On a Mac this works fine. The Angular code gets the URL with the # and
it does whatever it's supposed to do, and the server code gets the
proper mapped URL and all is well.

On Windows the URL Angular gets does not have the #, so it does not do
what it's supposed to do, and the server gets a bad URL and the
request fails.

The link I referenced (https://bugreports.qt.io/browse/QTWEBKIT-56)
mentions a bug with setUrl with URLs with a #, so I was wondering if
that is why we are seeing issues on Windows.



>
> There are no known problems with QUrl. Therefore, the problem is in your code
> that processes the URL.



More information about the Interest mailing list