diff --git a/src/node/hooks/express/admin.ts b/src/node/hooks/express/admin.ts index 708c9b452..87e94461b 100644 --- a/src/node/hooks/express/admin.ts +++ b/src/node/hooks/express/admin.ts @@ -23,11 +23,9 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func return cb(); } args.app.get('/admin/*', (req: any, res: any) => { - // parse URL - const parsedUrl = url.parse(req.url); // extract URL path - let pathname = ADMIN_PATH + `${parsedUrl.pathname}`; - pathname = path.normalize(path.join(ADMIN_PATH), parsedUrl.pathname) + let pathname = path.join(ADMIN_PATH + req.url); + pathname = path.normalize(pathname) if (!pathname.startsWith(ADMIN_PATH)) { res.statusCode = 403; diff --git a/src/tests/frontend-new/admin-spec/adminupdateplugins.spec.ts b/src/tests/frontend-new/admin-spec/adminupdateplugins.spec.ts index c1121d41b..214202350 100644 --- a/src/tests/frontend-new/admin-spec/adminupdateplugins.spec.ts +++ b/src/tests/frontend-new/admin-spec/adminupdateplugins.spec.ts @@ -13,18 +13,17 @@ test.describe('Plugins page', ()=> { await page.waitForSelector('.search-field'); const pluginTable = page.locator('table tbody').nth(1); await expect(pluginTable).not.toBeEmpty() - const plugins = await pluginTable.locator('tr').count() - expect(plugins).toBeGreaterThan(10) + await expect(pluginTable.locator('tr')).toHaveCount(190) }) test('Searches for a plugin', async ({page}) => { await page.waitForSelector('.search-field'); await page.click('.search-field') - await page.keyboard.type('ep_font_color3') + await page.keyboard.type('ep_font_color') await page.keyboard.press('Enter') const pluginTable = page.locator('table tbody').nth(1); await expect(pluginTable.locator('tr')).toHaveCount(1) - await expect(pluginTable.locator('tr').first()).toContainText('ep_font_color3') + await expect(pluginTable.locator('tr').first()).toContainText('ep_font_color') }) @@ -35,17 +34,17 @@ test.describe('Plugins page', ()=> { timeout: 15000 }) const plugins = await pluginTable.locator('tr').count() - expect(plugins).toBeGreaterThan(10) + await expect(pluginTable.locator('tr')).toHaveCount(190) // Now everything is loaded, lets install a plugin await page.click('.search-field') - await page.keyboard.type('ep_font_color3') + await page.keyboard.type('ep_font_color') await page.keyboard.press('Enter') await expect(pluginTable.locator('tr')).toHaveCount(1) const pluginRow = pluginTable.locator('tr').first() - await expect(pluginRow).toContainText('ep_font_color3') + await expect(pluginRow).toContainText('ep_font_color') // Select Installation button await pluginRow.locator('td').nth(4).locator('button').first().click() @@ -59,7 +58,7 @@ test.describe('Plugins page', ()=> { const installedPluginRow = installedPluginsRows.nth(1) - await expect(installedPluginRow).toContainText('ep_font_color3') + await expect(installedPluginRow).toContainText('ep_font_color') await installedPluginRow.locator('td').nth(2).locator('button').first().click() // Wait for the uninstallation to complete