Commit 739e82eb authored by Mikaël Salson's avatar Mikaël Salson
Browse files

controllers/file.py: Clearer string comparison

See !45
parent 2d7dd418
......@@ -646,14 +646,7 @@ def restart_pre_process():
def match_filetype(filename, extension):
ext_len = len(extension)
if len(filename) < ext_len:
return False
i = -1
while (abs(i) < ext_len):
if filename[i] != extension[i]:
return False
i = i - 1
return True
return filename[-ext_len:] == extension
def filesystem():
json = []
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment