From 7e828a5eb04afe476e596cf88000e53c2f93f45e Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 23 May 2021 21:48:45 +0200 Subject: The commit-patch length-check also checks line length --- api/git.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/git.js b/api/git.js index 5c6f0d9..dad7cc6 100644 --- a/api/git.js +++ b/api/git.js @@ -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(), -- cgit v1.2.3-18-g5258