Merge pull request #15980 from matt-200/master
plugin-azure-devops-backend encoded host breaks readme
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
getAvatarUrl,
|
||||
getPullRequestLink,
|
||||
replaceReadme,
|
||||
buildEncodedUrl,
|
||||
} from './azure-devops-utils';
|
||||
import { GitPullRequest } from 'azure-devops-node-api/interfaces/GitInterfaces';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
@@ -278,3 +279,19 @@ describe('replaceReadme', () => {
|
||||
expect(expected).toBe(result);
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildEncodedUrl', () => {
|
||||
it('should not encode the colon between host and port', async () => {
|
||||
const result = await buildEncodedUrl(
|
||||
'tfs.myorg.com:8443',
|
||||
'org',
|
||||
'project',
|
||||
'repo',
|
||||
'path',
|
||||
);
|
||||
|
||||
expect(result).toBe(
|
||||
'https://tfs.myorg.com:8443/org/project/_git/repo?path=path',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -242,12 +242,11 @@ export function buildEncodedUrl(
|
||||
repo: string,
|
||||
path: string,
|
||||
): string {
|
||||
const encodedHost = encodeURIComponent(host);
|
||||
const encodedOrg = encodeURIComponent(org);
|
||||
const encodedProject = encodeURIComponent(project);
|
||||
const encodedRepo = encodeURIComponent(repo);
|
||||
const encodedPath = encodeURIComponent(path);
|
||||
return `https://${encodedHost}/${encodedOrg}/${encodedProject}/_git/${encodedRepo}?path=${encodedPath}`;
|
||||
return `https://${host}/${encodedOrg}/${encodedProject}/_git/${encodedRepo}?path=${encodedPath}`;
|
||||
}
|
||||
|
||||
function convertReviewer(
|
||||
|
||||
Reference in New Issue
Block a user