Explorar o código

#742 raise ValueError when hiding the "/_nicegui" route

Falko Schindler %!s(int64=2) %!d(string=hai) anos
pai
achega
fce725d4c0
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      nicegui/app.py

+ 2 - 0
nicegui/app.py

@@ -71,6 +71,8 @@ class App(FastAPI):
         :param path: string that starts with a slash "/"
         :param directory: folder with static files to serve under the given path
         """
+        if path == '/':
+            raise ValueError('''Path cannot be "/", because it would hide NiceGUI's internal "/_nicegui" route.''')
         globals.app.mount(path, StaticFiles(directory=directory))
 
     def remove_route(self, path: str) -> None: