Merge pull request #5327 from SDA-SE/feat/client-url-escape
Feat/client url escape
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-kubernetes-backend': patch
|
||||
---
|
||||
|
||||
Use `string` TypeScript type instead of `String`.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/catalog-client': patch
|
||||
---
|
||||
|
||||
Make sure the `CatalogClient` escapes URL parameters correctly.
|
||||
@@ -42,10 +42,14 @@ export class CatalogClient implements CatalogApi {
|
||||
}
|
||||
|
||||
async getLocationById(
|
||||
id: String,
|
||||
id: string,
|
||||
options?: CatalogRequestOptions,
|
||||
): Promise<Location | undefined> {
|
||||
return await this.requestOptional('GET', `/locations/${id}`, options);
|
||||
return await this.requestOptional(
|
||||
'GET',
|
||||
`/locations/${encodeURIComponent(id)}`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
async getEntities(
|
||||
@@ -86,7 +90,9 @@ export class CatalogClient implements CatalogApi {
|
||||
const { kind, namespace = 'default', name } = compoundName;
|
||||
return this.requestOptional(
|
||||
'GET',
|
||||
`/entities/by-name/${kind}/${namespace}/${name}`,
|
||||
`/entities/by-name/${encodeURIComponent(kind)}/${encodeURIComponent(
|
||||
namespace,
|
||||
)}/${encodeURIComponent(name)}`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
@@ -171,14 +177,22 @@ export class CatalogClient implements CatalogApi {
|
||||
id: string,
|
||||
options?: CatalogRequestOptions,
|
||||
): Promise<void> {
|
||||
await this.requestIgnored('DELETE', `/locations/${id}`, options);
|
||||
await this.requestIgnored(
|
||||
'DELETE',
|
||||
`/locations/${encodeURIComponent(id)}`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
async removeEntityByUid(
|
||||
uid: string,
|
||||
options?: CatalogRequestOptions,
|
||||
): Promise<void> {
|
||||
await this.requestIgnored('DELETE', `/entities/by-uid/${uid}`, options);
|
||||
await this.requestIgnored(
|
||||
'DELETE',
|
||||
`/entities/by-uid/${encodeURIComponent(uid)}`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -46,7 +46,7 @@ export interface CatalogApi {
|
||||
|
||||
// Locations
|
||||
getLocationById(
|
||||
id: String,
|
||||
id: string,
|
||||
options?: CatalogRequestOptions,
|
||||
): Promise<Location | undefined>;
|
||||
getOriginLocationByEntity(
|
||||
|
||||
@@ -42,7 +42,7 @@ export class CatalogClientWrapper implements CatalogApi {
|
||||
}
|
||||
|
||||
async getLocationById(
|
||||
id: String,
|
||||
id: string,
|
||||
options?: CatalogRequestOptions,
|
||||
): Promise<Location | undefined> {
|
||||
return await this.client.getLocationById(id, {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import { AwsIamKubernetesAuthTranslator } from './AwsIamKubernetesAuthTranslator
|
||||
|
||||
export class KubernetesAuthTranslatorGenerator {
|
||||
static getKubernetesAuthTranslatorInstance(
|
||||
authProvider: String,
|
||||
authProvider: string,
|
||||
): KubernetesAuthTranslator {
|
||||
switch (authProvider) {
|
||||
case 'google': {
|
||||
|
||||
@@ -34,8 +34,8 @@ const mockFetch = (mock: jest.Mock) => {
|
||||
};
|
||||
|
||||
function generateMockResourcesAndErrors(
|
||||
serviceId: String,
|
||||
clusterName: String,
|
||||
serviceId: string,
|
||||
clusterName: string,
|
||||
) {
|
||||
if (clusterName === 'empty-cluster') {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user