KUrl or QUrl bug?

Sebastian Trüg trueg at kde.org
Sat Jun 19 13:36:14 BST 2010


On 06/19/2010 10:12 AM, Thiago Macieira wrote:
> Em Sábado 19. Junho 2010, às 08.53.27, Sebastian Trüg escreveu:
>> On 06/18/2010 11:28 PM, Ingo Klöcker wrote:
>>> On Friday 18 June 2010, Sebastian Trüg wrote:
>>>> On 06/18/2010 03:45 PM, David Faure wrote:
>>>>> On Thursday 17 June 2010, Sebastian Trüg wrote:
>>>>>> Hi guys,
>>>>>>
>>>>>> please find attached a patch to the kurltest which will make it
>>>>>> fail since an url on which you add a query item and then remove
>>>>>> it are not equal anymore.
>>>>>
>>>>> Yes, because "no query" isn't the same as "an empty query", IIRC.
>>>>> So after removing the query, you have a url with "an empty query".
>>>>> Did you try calling .url() on both urls? I suppose url3 will have a
>>>>> trailing '?'.
>>>>
>>>> exactly. I just think it is unwanted behavior. What exactly is this
>>>> good for? Who would ever want to have an empty query?
>>>
>>> Who would ever want to remove a query item from a query? I assume you
>>> need this because otherwise you wouldn't have filed this bug report. But
>>> why exactly do you need this?
>>
>> Well, maybe this can be seen as a corner case, too. But then it should
>> at least be documented that removing all query items will not remove the
>> query.
>> As for why I need it: I am cleaning up query URLs for saving them
>> without options. IMHO a stright-forward usecase. :)
> 
> Use setEncodedQuery to clear it.

I know that. But now I have to do:

if(url.queryItems().isEmpty())
  url.setEncodedQuery(QByteArray());

It works but it is just weird API. Anyway, it seems that I should let
this rest.
But could you please at least add a hint to the QUrl::removeQueryItem
docs? I think that would be very helpful in case anyone else runs into
the problem I had.

Thanks,
Sebastian




More information about the kde-core-devel mailing list