Update docs and fix tests

Signed-off-by: Marc Bruins <marc@marcbruins.nl>
This commit is contained in:
Marc Bruins
2022-12-24 18:43:24 +01:00
parent 206b9062a0
commit 3825687f5a
3 changed files with 20 additions and 4 deletions
+1 -1
View File
@@ -149,7 +149,7 @@ When using a custom pattern, the target is composed of five parts:
- The base instance URL, `https://dev.azure.com` in this case
- The organization name which is required, `myorg` in this case
- The project name which is required, `myproject` in this case
- The project name which is optional, `myproject` in this case. This defaults to \*, which scans all the projects where the token has access to.
- The repository blob to scan, which accepts \* wildcard tokens and must be
added after `_git/`. This can simply be `*` to scan all repositories in the
project.
@@ -164,6 +164,9 @@ describe('AzureDevOpsEntityProvider', () => {
repository: {
name: 'myrepo',
},
project: {
name: 'myproject',
},
},
],
'https://dev.azure.com/myorganization/myproject',
@@ -189,6 +192,9 @@ describe('AzureDevOpsEntityProvider', () => {
repository: {
name: 'myrepo',
},
project: {
name: 'myproject',
},
},
{
fileName: 'catalog-info.yaml',
@@ -196,6 +202,9 @@ describe('AzureDevOpsEntityProvider', () => {
repository: {
name: 'myotherrepo',
},
project: {
name: 'myproject',
},
},
],
'https://dev.azure.com/myorganization/myproject',
@@ -277,6 +286,9 @@ describe('AzureDevOpsEntityProvider', () => {
repository: {
name: 'myrepo',
},
project: {
name: 'myproject',
},
},
{
fileName: 'catalog-info.yaml',
@@ -284,6 +296,9 @@ describe('AzureDevOpsEntityProvider', () => {
repository: {
name: 'myotherrepo',
},
project: {
name: 'myproject',
},
},
],
'https://dev.azure.com/myorganization/myproject',
@@ -176,8 +176,9 @@ export class AzureDevOpsEntityProvider implements EntityProvider {
}
private createObjectUrl(file: CodeSearchResultItem): string {
const baseUrl = `https://${this.config.host}/${this.config.organization}`;
const encodedUri = `${baseUrl}/${file.project.name}/_git/${file.repository.name}?path=${file.path}`;
return encodedUri;
const baseUrl = `https://${this.config.host}/${this.config.organization}/${file.project.name}`;
return encodeURI(
`${baseUrl}/_git/${file.repository.name}?path=${file.path}`,
);
}
}