Merge pull request #25910 from kmarkow/fix-techdocs-edit-url-trailing-slash

Fix TechDocs Edit URL link when trailing slash not present
This commit is contained in:
John Philip
2024-08-06 14:42:19 -04:00
committed by GitHub
3 changed files with 7 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-node': patch
---
Fix TechDocs Edit URL for nested docs
@@ -115,6 +115,7 @@ describe('helpers', () => {
url | repo_url | edit_uri
${'https://github.com/backstage/backstage'} | ${'https://github.com/backstage/backstage'} | ${undefined}
${'https://github.com/backstage/backstage/tree/main/examples/techdocs/'} | ${'https://github.com/backstage/backstage/tree/main/examples/techdocs/'} | ${'https://github.com/backstage/backstage/edit/main/examples/techdocs/docs'}
${'https://github.com/backstage/backstage/tree/main/examples/techdocs'} | ${'https://github.com/backstage/backstage/tree/main/examples/techdocs'} | ${'https://github.com/backstage/backstage/edit/main/examples/techdocs/docs'}
${'https://github.com/backstage/backstage/tree/main/'} | ${'https://github.com/backstage/backstage/tree/main/'} | ${'https://github.com/backstage/backstage/edit/main/docs'}
${'https://gitlab.com/backstage/backstage'} | ${'https://gitlab.com/backstage/backstage'} | ${undefined}
${'https://gitlab.com/backstage/backstage/-/blob/main/examples/techdocs/'} | ${'https://gitlab.com/backstage/backstage/-/blob/main/examples/techdocs/'} | ${'https://gitlab.com/backstage/backstage/-/edit/main/examples/techdocs/docs'}
@@ -117,7 +117,7 @@ export const getRepoUrlFromLocationAnnotation = (
const sourceFolder = integration.resolveUrl({
url: `./${docsFolder}`,
base: target,
base: target.endsWith('/') ? target : `${target}/`,
});
return {
repo_url: target,