mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Add filename sanitiser
This commit is contained in:
parent
816b1d1977
commit
3ae086aff4
@ -35,6 +35,16 @@ class InputSanitizer(object):
|
|||||||
|
|
||||||
return text(value)
|
return text(value)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def filename(value):
|
||||||
|
'''
|
||||||
|
Remove everything that would affect paths in the filename
|
||||||
|
|
||||||
|
:param value:
|
||||||
|
:return:
|
||||||
|
'''
|
||||||
|
return re.sub('[^a-zA-Z0-9.-_ ]', '', os.path.basename(InputSanitizer.trim(value)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clean = InputSanitizer()
|
clean = InputSanitizer()
|
||||||
|
Loading…
Reference in New Issue
Block a user