Merge pull request #8366 from backstage/natasha/fix-scaffolder-owner-bug

Fix scaffolder repo owner bug
This commit is contained in:
Natasha Issayeva
2021-12-03 14:23:57 -08:00
committed by GitHub
2 changed files with 7 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder': patch
---
Fix bug with setting owner in RepoUrlPicker causing validation failure
@@ -27,7 +27,7 @@ import FormHelperText from '@material-ui/core/FormHelperText';
import { useApi } from '@backstage/core-plugin-api';
import { Progress } from '@backstage/core-components';
function splitFormData(url: string | undefined, allowedOwners: string[]) {
function splitFormData(url: string | undefined, allowedOwners?: string[]) {
let host = undefined;
let owner = undefined;
let repo = undefined;
@@ -39,10 +39,7 @@ function splitFormData(url: string | undefined, allowedOwners: string[]) {
if (url) {
const parsed = new URL(`https://${url}`);
host = parsed.host;
owner =
parsed.searchParams.get('owner') || allowedOwners
? allowedOwners[0]
: undefined;
owner = parsed.searchParams.get('owner') || allowedOwners?.[0];
repo = parsed.searchParams.get('repo') || undefined;
// This is azure dev ops specific. not used for any other provider.
organization = parsed.searchParams.get('organization') || undefined;