mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-12 18:32:44 +00:00
handle invalid commit sha
This commit is contained in:
@@ -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 = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user