Switch from stat to du and cut to make this tool (more) POSIX compatible. Fixes #3.
This commit is contained in:
parent
92601ce19e
commit
8f9e3adec1
1 changed files with 1 additions and 1 deletions
|
|
@ -235,7 +235,7 @@ send_file() {
|
||||||
# Query max filesize from server
|
# Query max filesize from server
|
||||||
get "/_matrix/media/r0/config"
|
get "/_matrix/media/r0/config"
|
||||||
max_size=`jq -r ".[\"m.upload.size\"]" <<<"$response"`
|
max_size=`jq -r ".[\"m.upload.size\"]" <<<"$response"`
|
||||||
size=$(stat -c%s "$FILE")
|
size=$(du -b "$FILE" | cut -f1)
|
||||||
if (( size > max_size )); then
|
if (( size > max_size )); then
|
||||||
die "File is too big. Size is $size, max_size is $max_size."
|
die "File is too big. Size is $size, max_size is $max_size."
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue