chore: encode some values too

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-01-31 21:17:53 +01:00
parent 37a3fc75c0
commit ac23003f62
2 changed files with 8 additions and 3 deletions
@@ -23,12 +23,11 @@ import {
scmAuthApiRef,
ScmAuthApi,
} from '@backstage/integration-react';
import { scaffolderApiRef } from '../../../api';
import { scaffolderApiRef, ScaffolderApi } from '../../../api';
import {
SecretsContextProvider,
SecretsContext,
} from '../../secrets/SecretsContext';
import { ScaffolderApi } from '../../..';
import { act, fireEvent } from '@testing-library/react';
describe('RepoUrlPicker', () => {
@@ -92,11 +92,17 @@ export const RepoUrlPicker = (
return;
}
const [host, owner, repoName] = [
state.host,
state.owner,
state.repoName,
].map(encodeURIComponent);
// user has requested that we use the users credentials
// so lets grab them using the scmAuthApi and pass through
// any additional scopes from the ui:options
const { token } = await scmAuthApi.getCredentials({
url: `https://${state.host}/${state.owner}/${state.repoName}`,
url: `https://${host}/${owner}/${repoName}`,
additionalScope: {
repoWrite: true,
customScopes: requestUserCredentials.additionalScopes,