handle invalid commit sha

This commit is contained in:
tdurieux
2021-04-22 08:38:49 +02:00
parent a4c722bf77
commit 7c88392aba

View File

@@ -120,7 +120,11 @@ module.exports.getTree = async (repoConfig, sha, truncatedTree, parentPath) => {
const repo = gh(repoConfig.fullName);
if (!sha) {
sha = repoConfig.commit ? repoConfig.commit : "HEAD";
if (repoConfig.commit && !/^[a-f0-9]+$/.test(repoConfig.commit)) {
sha = repoConfig.commit
} else {
sha = "HEAD"
}
}
if (!parentPath) parentPath = "";