Skip to content

Commit e88c32f

Browse files
ANKUR DWIVEDIANKUR DWIVEDI
authored andcommitted
code readibility
1 parent 82d8e94 commit e88c32f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

imagekitio/constants/defaults.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ class Default(enum.Enum):
1616
TRANSFORM_KEY_VALUE_DELIMITER = "-"
1717
SIGNATURE_PARAMETER = "ik-s"
1818
TIMESTAMP_PARAMETER = "ik-t"
19+
IGNORE_CHARACTERS = '~@#$&()*!+=:;,?/\''
20+
IGNORE_CHARACTERS_WITHOUT_COMMA = '~@#$&()*!+=:;?/\''

imagekitio/url.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ def encodeURI(url_str):
218218
if "?" in url_str:
219219
# here, we have applied the quote(unquote(url)) function to handle the query string.
220220
# This function ensures that characters in the query are properly encoded. While some characters are already encoded, others require encoding for correct processing.
221-
encoded_url = quote(url_str.split('?')[0], safe='~@#$&()*!+=:;,?/\'')+"?"+quote(unquote(url_str.split('?')[1]), safe='~@#$&()*!+=:;?/\'')
221+
encoded_url = quote(url_str.split('?')[0], safe=Default.IGNORE_CHARACTERS.value)+"?"+quote(unquote(url_str.split('?')[1]), safe=Default.IGNORE_CHARACTERS_WITHOUT_COMMA.value)
222222
else:
223-
encoded_url = quote(url_str.split('?')[0], safe='~@#$&()*!+=:;,?/\'')
223+
encoded_url = quote(url_str, safe=Default.IGNORE_CHARACTERS.value)
224224
return encoded_url
225225

226226
@staticmethod

0 commit comments

Comments
 (0)