Merge pull request #4501 from backstage/blam/fix-bitbucket

Fix path parsing for Bitbucket + other preparers
This commit is contained in:
Ben Lambert
2021-02-11 20:39:45 +01:00
committed by GitHub
4 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Fix parsing of the path to default to empty string not undefined if git-url-parse throws something we don't expect. Fixes the error `The "path" argument must be of type string.` when preparing.
@@ -43,7 +43,7 @@ export class BitbucketPreparer implements PreparerBase {
const targetPath = path.join(workspacePath, 'template');
const fullPathToTemplate = path.resolve(
checkoutPath,
parsedGitUrl.filepath,
parsedGitUrl.filepath ?? '',
);
const git = Git.fromAuth({ logger, ...this.getAuth() });
@@ -33,7 +33,7 @@ export class GithubPreparer implements PreparerBase {
const targetPath = path.join(workspacePath, 'template');
const fullPathToTemplate = path.resolve(
checkoutPath,
parsedGitUrl.filepath,
parsedGitUrl.filepath ?? '',
);
const git = this.config.token
@@ -33,7 +33,7 @@ export class GitlabPreparer implements PreparerBase {
const targetPath = path.join(workspacePath, 'template');
const fullPathToTemplate = path.resolve(
checkoutPath,
parsedGitUrl.filepath,
parsedGitUrl.filepath ?? '',
);
parsedGitUrl.git_suffix = true;