Skip to content

Commit 2537273

Browse files
committed
increase size limit
1 parent d33dc1d commit 2537273

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scripts/lint_file_size.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77

88
set -euo pipefail
99

10-
# Default max file size in bytes (1 MB)
11-
if [[ "$filepath" =~ \.(png|jpg|jpeg|gif|svg)$ ]]; then
12-
MAX_SIZE=$((5 * 1024 * 1024)) # 5 MB limit for pictures
13-
else
14-
MAX_SIZE=$((1 * 1024 * 1024)) # 1 MB for others
15-
fi
16-
1710
status=0
1811

1912
green='\e[1;32m'; red='\e[1;31m'; cyan='\e[1;36m'; reset='\e[0m'
@@ -30,6 +23,13 @@ fi
3023

3124
for file in $files; do
3225
if [ -f "$file" ]; then
26+
# Set size limit depending on extension
27+
if [[ "$file" =~ \.(png|jpg|jpeg|gif|svg|mp3|mp4)$ ]]; then
28+
MAX_SIZE=$((8 * 1024 * 1024)) # 5 MB for pictures
29+
else
30+
MAX_SIZE=$((1 * 1024 * 1024)) # 1 MB for others
31+
fi
32+
3333
size=$(wc -c <"$file")
3434
if [ "$size" -gt "$MAX_SIZE" ]; then
3535
echo -e "${red}FAIL${reset} $file (${cyan}${size} bytes${reset}) exceeds ${MAX_SIZE} bytes"

0 commit comments

Comments
 (0)