Frontend created and rewritten a few times, with some backend fixes (#1)
The software is fully operational. Reviewed-on: #1
This commit is contained in:
0
cista/util/__init__.py
Normal file
0
cista/util/__init__.py
Normal file
@@ -33,7 +33,8 @@ async def handle_sanic_exception(request, e):
|
||||
# Non-browsers get JSON errors
|
||||
if "text/html" not in request.headers.accept:
|
||||
return jres(
|
||||
ErrorMsg({"code": code, "message": message, **context}), status=code
|
||||
ErrorMsg({"code": code, "message": message, **context}),
|
||||
status=code,
|
||||
)
|
||||
# Redirections flash the error message via cookies
|
||||
if "redirect" in context:
|
||||
|
||||
3
cista/util/asynclink.py
Executable file → Normal file
3
cista/util/asynclink.py
Executable file → Normal file
@@ -80,8 +80,9 @@ class SyncRequest:
|
||||
if exc:
|
||||
self.set_exception(exc)
|
||||
return True
|
||||
elif not self.done:
|
||||
if not self.done:
|
||||
self.set_result(None)
|
||||
return None
|
||||
|
||||
def set_result(self, value):
|
||||
"""Set result value; mark as done."""
|
||||
|
||||
@@ -10,4 +10,7 @@ def sanitize(filename: str) -> str:
|
||||
filename = filename.replace("\\", "-")
|
||||
filename = sanitize_filepath(filename)
|
||||
filename = filename.strip("/")
|
||||
return PurePosixPath(filename).as_posix()
|
||||
p = PurePosixPath(filename)
|
||||
if any(n.startswith(".") for n in p.parts):
|
||||
raise ValueError("Filenames starting with dot are not allowed")
|
||||
return p.as_posix()
|
||||
|
||||
2
cista/util/lrucache.py
Executable file → Normal file
2
cista/util/lrucache.py
Executable file → Normal file
@@ -41,7 +41,7 @@ class LRUCache:
|
||||
The corresponding item's handle.
|
||||
"""
|
||||
# Take from cache or open a new one
|
||||
for i, (k, f, ts) in enumerate(self.cache):
|
||||
for i, (k, f, _ts) in enumerate(self.cache): # noqa: B007
|
||||
if k == key:
|
||||
self.cache.pop(i)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user