diff options
author | HampusM <hampus@hampusmat.com> | 2021-05-23 21:48:45 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-05-23 21:48:45 +0200 |
commit | 7e828a5eb04afe476e596cf88000e53c2f93f45e (patch) | |
tree | c6bbb51c6129ac7f33794057473e8e530a634271 | |
parent | 7c9dfd45ad041a1ee374618321684deda30a9fb4 (diff) |
The commit-patch length-check also checks line length
-rw-r--r-- | api/git.js | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -157,9 +157,10 @@ async function getCommit(base_dir, repo_name, commit_oid) const patch_end = (patch_header_data[0][patch_index + 1] !== undefined) ? patch_header_data[0][patch_index + 1] : all_patches.length - 1; const patch_content = all_patches.slice(patch_start, patch_end); - console.log(patch_content.length); - if(patch_content.length > 5000) { - console.log("Collapsed!"); + const line_lengths = patch_content.map((line) => line.length).reduce((acc, length) => acc + length); + + if(patch_content.length > 5000 || line_lengths > 5000) { + console.log("Too large!"); arr.push({ from: patch.oldFile().path(), |