14
14
from sanic_cors import CORS
15
15
from websockets .legacy .protocol import WebSocketCommonProtocol
16
16
17
- from idom .config import IDOM_WEB_MODULES_DIR
18
17
from idom .core .hooks import Context , create_context , use_context
19
18
from idom .core .layout import Layout , LayoutEvent
20
19
from idom .core .serve import (
27
26
from idom .core .types import RootComponentConstructor
28
27
29
28
from ._asgi import serve_development_asgi
30
- from .utils import CLIENT_BUILD_DIR , client_build_dir_path
29
+ from .utils import safe_client_build_dir_path , safe_web_modules_dir_path
31
30
32
31
33
32
logger = logging .getLogger (__name__ )
@@ -122,7 +121,7 @@ async def single_page_app_files(
122
121
path : str = "" ,
123
122
) -> response .HTTPResponse :
124
123
path = urllib_parse .unquote (path )
125
- return await response .file (CLIENT_BUILD_DIR / client_build_dir_path (path ))
124
+ return await response .file (safe_client_build_dir_path (path ))
126
125
127
126
blueprint .add_route (single_page_app_files , "/" )
128
127
blueprint .add_route (single_page_app_files , "/<path:path>" )
@@ -132,9 +131,8 @@ async def web_module_files(
132
131
path : str ,
133
132
_ : str = "" , # this is not used
134
133
) -> response .HTTPResponse :
135
- wm_dir = IDOM_WEB_MODULES_DIR .current
136
134
path = urllib_parse .unquote (path )
137
- return await response .file (wm_dir . joinpath ( * path . split ( "/" ) ))
135
+ return await response .file (safe_web_modules_dir_path ( path ))
138
136
139
137
blueprint .add_route (web_module_files , "/_api/modules/<path:path>" )
140
138
blueprint .add_route (web_module_files , "/<_:path>/_api/modules/<path:path>" )
0 commit comments