Ensure URL encoding of tilde when sanitizing refname

Fixes mnauw/git-remote-hg#44
This commit is contained in:
Mark Nauwelaerts
2021-08-28 20:16:54 +02:00
parent cdcd70b453
commit 7159e4a030

View File

@@ -193,7 +193,9 @@ def gitref(ref):
# standard url percentage encoding with a (legacy) twist:
# ' ' -> '___'
# '___' also percentage encoded
return compat.urlquote(ref).replace(b'___', b'%5F%5F%5F').replace(b'%20', b'___')
# python 3.6 considers ~ reserved, whereas python 3.7 no longer
return compat.urlquote(ref).replace(b'___', b'%5F%5F%5F'). \
replace(b'%20', b'___').replace(b'~', b'%7E')
def check_version(*check):
if not hg_version: