diff --git a/pywebfs/pywebfs.py b/pywebfs/pywebfs.py index 3608d87..4f7cb9f 100755 --- a/pywebfs/pywebfs.py +++ b/pywebfs/pywebfs.py @@ -9,6 +9,7 @@ import urllib import html import base64 +import unicodedata from functools import lru_cache # python 3.6 no TheedingHTTPServer @@ -529,6 +530,7 @@ """ #JAVASCRIPT=f"" RE_AGENT = re.compile(r"(Edg|Chrome|Safari|Firefox|Opera|Lynx)[^ ]*") +RE_ACCENT = re.compile(r"[\u0300-\u036f]") class BadStat: st_size = 0 @@ -948,7 +950,10 @@ def list_directory(self, path): self.write_html("\n") self.write_html('
0 file - 0 B
\n') return - entries = sorted(entries, key=lambda entry: (not entry.is_dir(), entry.name.lower())) + entries = sorted(entries, key=lambda entry: ( + not entry.is_dir(), + RE_ACCENT.sub("", unicodedata.normalize("NFD", entry.name.lower())) + )) nbfiles = 0 size = 0 for entry in entries: