Selaa lähdekoodia

fix(admin-ui-plugin): Fix issue with sendFile and absolute paths (#3499)

Johan Dahl 8 kuukautta sitten
vanhempi
sitoutus
62664cbe39

+ 1 - 1
packages/admin-ui-plugin/src/plugin.ts

@@ -259,7 +259,7 @@ export class AdminUiPlugin implements NestModule {
         adminUiServer.use(limiter as any);
         adminUiServer.use(express.static(adminUiAppPath));
         adminUiServer.use((req, res) => {
-            res.sendFile(path.join(adminUiAppPath, 'index.html'));
+            res.sendFile('index.html', { root: adminUiAppPath });
         });
 
         return adminUiServer;

+ 1 - 1
packages/email-plugin/src/dev-mailbox.ts

@@ -20,7 +20,7 @@ export class DevMailbox {
         const { outputPath, handlers } = options;
         const server = Router();
         server.get('/', (req, res) => {
-            res.sendFile(path.join(__dirname, '../../dev-mailbox.html'));
+            res.sendFile('dev-mailbox.html', { root: path.join(__dirname, '../..') });
         });
         server.get('/list', async (req, res) => {
             const list = await fs.readdir(outputPath);