mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-08-15 00:10:44 +02:00
handle invalid commit sha
This commit is contained in:
+5
-1
@@ -120,7 +120,11 @@ module.exports.getTree = async (repoConfig, sha, truncatedTree, parentPath) => {
|
|||||||
const repo = gh(repoConfig.fullName);
|
const repo = gh(repoConfig.fullName);
|
||||||
|
|
||||||
if (!sha) {
|
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 = "";
|
if (!parentPath) parentPath = "";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user