ada-url/ada

Calling ada_clear_pathname leads to inconsistent results

bbayles opened this issue · 4 comments

Version

2.6.4

Platform

All


What steps will reproduce the bug?

Start with this URL:

https://user_1:password_1@example.org?q=1

When processed by ada, it will produce a href like this:

https://user_1:password_1@example.org/?q=1

That is, a / is inserted before the ?q=1.


Now start with this URL

https://user_1:password_1@example.org/api?q=1

Then call ada_clear_pathname on it. The href is now:

https://user_1:password_1@example.org?q=1

The / is missing.


This test on the Python bindings demonstrates the problem.

It is not possible to offer this functionality without also impacting the performance of the url_aggregator, since it also needs to check search and hash parameter existence. For now, we can use ada_set_pathname('') for the remove operation.

@anonrig: suppose I've got this URL:

https://user_1:password_1@example.org:8080/api?q=1#frag

I then set ada_set_pathname(''). I get:

https://user_1:password_1@example.org:8080/q=1#frag

Another bug, yes?

Apologies; I think this was my bug and not yours!

Apologies; I think this was my bug and not yours!

Pew, I was about to sweat.