diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ac23d03..0000000 --- a/.gitmodules +++ /dev/null @@ -1,5 +0,0 @@ -[submodule "frontend"] - path = frontend - url = https://github.com/opendatalab/labelU-frontend.git - branch = main - ignore = dirty \ No newline at end of file diff --git a/labelu/main.py b/labelu/main.py index 4d460e4..518c7a4 100644 --- a/labelu/main.py +++ b/labelu/main.py @@ -103,9 +103,13 @@ def __init__(self, *args: Any, **kwargs: Any): def file_response(self, *args: Any, **kwargs: Any) -> Response: resp = super().file_response(*args, **kwargs) - resp.headers.setdefault("Cache-Control", self.cachecontrol) - resp.headers.setdefault("Pragma", self.pragma) - resp.headers.setdefault("Expires", self.expires) + + # No cache for html files + if resp.media_type == "text/html": + resp.headers.setdefault("Cache-Control", self.cachecontrol) + resp.headers.setdefault("Pragma", self.pragma) + resp.headers.setdefault("Expires", self.expires) + return resp app.mount("", NoCacheStaticFiles(packages=["labelu.internal"], html=True))