mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
e06fe8a52a
Apply black formatting to codebase
25 lines
764 B
Python
25 lines
764 B
Python
from typing import Optional
|
|
|
|
try:
|
|
import tornado.web
|
|
|
|
except ModuleNotFoundError as e:
|
|
from app.classes.shared.helpers import helper
|
|
|
|
helper.auto_installer_fix(e)
|
|
|
|
|
|
class CustomStaticHandler(tornado.web.StaticFileHandler):
|
|
def validate_absolute_path(self, root: str, absolute_path: str) -> Optional[str]:
|
|
try:
|
|
return super().validate_absolute_path(root, absolute_path)
|
|
except tornado.web.HTTPError as error:
|
|
if "HTTP 404: Not Found" in str(error):
|
|
self.set_status(404)
|
|
self.finish(
|
|
{
|
|
"error": "NOT_FOUND",
|
|
"info": "The requested resource was not found on the server",
|
|
}
|
|
)
|