gruns / gruns/furl

URL fragment percent-encoding

Open
#172 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.8k
Forks
165
PR merge metrics
No merged PRs in 30d

Description

We are using `furl` to normalize templated URLs:

```python
normalized_url = furl(rendered_url).tostr("&", False)
```

But we encounter a bit of an odd behavior when normalizing URLs which have a very specific fragment, and aren't sure if this is an expected or not.

For example normalizing following URL yields an unexpected result (fragment's forward slash gets percent-encoded):

```python
normalized_url = furl("https://example.com/path/#/foo=123").tostr("&", False)
# Actual: https://example.com/path/#%2Ffoo=123
# Expected: https://example.com/path/#/foo=123
```

However when the URL fragment contains a separator (`?`) or does not contain an equals sign (`=`) it works as expected:
```python
normalized_url = furl("https://example.com/path/#/?foo=123").tostr("&", False)
# Actual: https://example.com/path/#/?foo=123
# Expected: https://example.com/path/#/?foo=123

normalized_url = furl("https://example.com/path/#/foo").tostr("&", False)
# Actual: https://example.com/path/#/foo
# Expected: https://example.com/path/#/foo
```

We are using the latest version of `furl==2.1.2`.

Looking forward to your feedback.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.