Switch from stat to du and cut to make this tool (more) POSIX compatible. Fixes #3.

This commit is contained in:
Fabian Schlenz 2020-02-05 12:49:52 +01:00
parent 92601ce19e
commit 8f9e3adec1

View file

@ -235,7 +235,7 @@ send_file() {
# Query max filesize from server
get "/_matrix/media/r0/config"
max_size=`jq -r ".[\"m.upload.size\"]" <<<"$response"`
size=$(stat -c%s "$FILE")
size=$(du -b "$FILE" | cut -f1)
if (( size > max_size )); then
die "File is too big. Size is $size, max_size is $max_size."
fi