Skip to content

Commit a9c44f7

Browse files
authored
fix: add mapping .br extension to the same path without it (#32)
* fix: add mapping .br extension to the same path without it * typing
1 parent f62c019 commit a9c44f7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/decentraland-ecs/src/setupProxy.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,19 @@ const setupProxy = (dcl: any, app: express.Application) => {
6161
}
6262

6363
createStaticRoutes(app, '/images/decentraland-connect/*', dclKernelImagesDecentralandConnect)
64-
createStaticRoutes(app, '/@/artifacts/unity-renderer/*', dclUnityRenderer)
64+
createStaticRoutes(app, '/@/artifacts/unity-renderer/*', dclUnityRenderer, (filePath) =>
65+
filePath.replace(/.br+$/, '')
66+
)
6567
createStaticRoutes(app, '/@/artifacts/loader/*', dclKernelLoaderPath)
6668
createStaticRoutes(app, '/default-profile/*', dclKernelDefaultProfilePath)
6769
}
6870

69-
const createStaticRoutes = (app: express.Application, route: string, localFolder: string) => {
71+
const createStaticRoutes = (
72+
app: express.Application,
73+
route: string,
74+
localFolder: string,
75+
mapFile?: ((filePath: string) => string)
76+
) => {
7077
app.use(route, (req, res, next) => {
7178
const options = {
7279
root: localFolder,
@@ -82,7 +89,7 @@ const createStaticRoutes = (app: express.Application, route: string, localFolder
8289
}
8390
}
8491

85-
const fileName = req.params[0]
92+
const fileName: string = mapFile ? mapFile(req.params[0]) : req.params[0]
8693

8794
res.sendFile(fileName, options, (err) => {
8895
if (err) {

0 commit comments

Comments
 (0)