question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

urlencode doesn't escape slashes

See original GitHub issue

This was raised in #444, but this code always evaluates to b'/' on Python 3.4.1, so slashes still not escaped.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

11reactions
mitsuhikocommented, Mar 28, 2017

That’s fair enough but in practice it’s not necessary there either and included credentials are deprecated anyways. Since those are unlikely to be produced within templates it’s an edge case that is not really worth considering.

7reactions
ahuffmancommented, Apr 4, 2018

I hit this issue when trying to create a file in a gitlab repository via API calls. The gitlab api requires the slashes to be encoded. To make this work I do: {{ myvar | urlencode | regex_replace(‘/’,‘%2F’) }}. I’m working with Ansible and Jinja2 filters in my playbook tasks. This could be a workaround for those of you hitting this, as I validated it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

escaping - slashes in url variables - Stack Overflow
You need to escape those but don't just replace it by %2F manually. You can use URLEncoder for this. Eg URLEncoder.encode(url, "UTF-8"). Then...
Read more >
URL-Encoding of "slashes" - Online
Encode slashes to URL-encoded format with various advanced options. Our site has an easy to use online tool to convert your data.
Read more >
HTML URL Encoding Reference - W3Schools
Character From Windows‑1252 From UTF‑8 space %20 %20 ! %21 %21 " %22 %22
Read more >
encodeURIComponent() - JavaScript - MDN Web Docs
The encodeURIComponent() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape ...
Read more >
[SOLVED] URL-encoded slash ("/") character does not work
Chars like %2F are invalid in URL paths as defined in RFC 3986 Section 3.3. Why don't you send your search values as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found