diff --git a/.changeset/techdocs-flying-inspection.md b/.changeset/techdocs-flying-inspection.md new file mode 100644 index 0000000000..baf956ee19 --- /dev/null +++ b/.changeset/techdocs-flying-inspection.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-node': patch +--- + +Updated deprecated use of `express`' `res.redirect()` method when handling legacy path casing. diff --git a/plugins/techdocs-node/src/stages/publish/local.test.ts b/plugins/techdocs-node/src/stages/publish/local.test.ts index daf943dce4..0119def16d 100644 --- a/plugins/techdocs-node/src/stages/publish/local.test.ts +++ b/plugins/techdocs-node/src/stages/publish/local.test.ts @@ -24,6 +24,7 @@ import request from 'supertest'; import mockFs from 'mock-fs'; import * as os from 'os'; import { LocalPublish } from './local'; +import path from 'path'; const createMockEntity = (annotations = {}, lowerCase = false) => { return { @@ -145,7 +146,7 @@ describe('local publisher', () => { ...{ kind: 'component', metadata: { - name: '../component/other-component', + name: path.join('..', 'component', 'other-component'), namespace: 'default', }, }, diff --git a/plugins/techdocs-node/src/stages/publish/local.ts b/plugins/techdocs-node/src/stages/publish/local.ts index c0de46eb22..11c6e6dd2b 100644 --- a/plugins/techdocs-node/src/stages/publish/local.ts +++ b/plugins/techdocs-node/src/stages/publish/local.ts @@ -220,7 +220,7 @@ export class LocalPublish implements PublisherBase { } // Otherwise, redirect to the new path. - return res.redirect(req.baseUrl + newPath, 301); + return res.redirect(301, req.baseUrl + newPath); }); router.use(