Prettify URLs before displaying them to the user

This commit is contained in:
Kovid Goyal
2022-12-29 17:04:02 +05:30
parent f4ac03b791
commit 306f9e5735
3 changed files with 21 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ from kitty.fast_data_types import (
wcwidth, expand_ansi_c_escapes
)
from kitty.rgb import to_color
from kitty.utils import is_path_in_temp_dir, sanitize_title
from kitty.utils import is_path_in_temp_dir, sanitize_title, sanitize_url_for_dispay_to_user
from . import BaseTest, filled_cursor, filled_history_buf, filled_line_buf
@@ -436,6 +436,8 @@ class TestDataTypes(BaseTest):
self.assertTrue(is_path_in_temp_dir(os.path.join(prefix, path)))
for path in ('/home/xy/d.png', '/tmp/../home/x.jpg'):
self.assertFalse(is_path_in_temp_dir(os.path.join(path)))
self.ae(sanitize_url_for_dispay_to_user(
'h://a\u0430b.com/El%20Ni%C3%B1o/'), 'h://xn--ab-7kc.com/El Niño/')
def test_color_profile(self):
c = ColorProfile()