Enable non unicode character in catalog import.

replaced btoa with js-base64 so the code can gracefully handle non unicode characters.

Signed-off-by: Podge <padraig@padraigobrien.com>
This commit is contained in:
Podge
2021-03-26 20:13:05 +00:00
parent 3bf4ea86eb
commit f9c75f7a93
4 changed files with 13 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-import': patch
---
When importing components you will now have the ability to use non unicode characters in the entity owner field
+1
View File
@@ -43,6 +43,7 @@
"@octokit/rest": "^18.0.12",
"@types/react": "^16.9",
"git-url-parse": "^11.4.4",
"js-base64": "^3.6.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-hook-form": "^6.15.4",
@@ -21,6 +21,7 @@ import {
GitHubIntegrationConfig,
ScmIntegrationRegistry,
} from '@backstage/integration';
import { Base64 } from 'js-base64';
import { Octokit } from '@octokit/rest';
import { PartialEntity } from '../types';
import { AnalyzeResult, CatalogImportApi } from './CatalogImportApi';
@@ -300,7 +301,7 @@ export class CatalogImportClient implements CatalogImportApi {
repo,
path: fileName,
message: title,
content: btoa(fileContent),
content: Base64.encode(fileContent),
branch: branchName,
})
.catch(e => {
+5
View File
@@ -16882,6 +16882,11 @@ joycon@^2.2.5:
resolved "https://registry.npmjs.org/joycon/-/joycon-2.2.5.tgz#8d4cf4cbb2544d7b7583c216fcdfec19f6be1615"
integrity sha512-YqvUxoOcVPnCp0VU1/56f+iKSdvIRJYPznH22BdXV3xMk75SFXhWeJkZ8C9XxUWt1b5x2X1SxuFygW1U0FmkEQ==
js-base64@^3.6.0:
version "3.6.0"
resolved "https://registry.npmjs.org/js-base64/-/js-base64-3.6.0.tgz#773e1de628f4f298d65a7e9842c50244751f5756"
integrity sha512-wVdUBYQeY2gY73RIlPrysvpYx+2vheGo8Y1SNQv/BzHToWpAZzJU7Z6uheKMAe+GLSBig5/Ps2nxg/8tRB73xg==
js-cookie@^2.2.1:
version "2.2.1"
resolved "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"