File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 77
88set -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-
1710status=0
1811
1912green=' \e[1;32m' ; red=' \e[1;31m' ; cyan=' \e[1;36m' ; reset=' \e[0m'
3023
3124for 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"
You can’t perform that action at this time.
0 commit comments