Use regex for trimming file:// destinations

A problem with cut was causing:

  $ DEST="file:///media/user/data"
  $ TMPDEST=$(echo "${DEST}" | cut -c 6-)
  $ echo $TMPDEST
  ///media/user/data

The fix uses a regex instead so that we trim away things correctly. It also seems somewhat more
readable.
This commit is contained in:
Andrea Richiardi 2017-11-13 21:11:50 -08:00
parent dba25a57de
commit 6377ad5281

View file

@ -650,7 +650,7 @@ get_remote_file_size()
;;
"fi")
FRIENDLY_TYPE_NAME="File"
TMPDEST=$(echo "${DEST}" | cut -c 6-)
TMPDEST="${DEST#file://*}"
SIZE=$(du -hs "${TMPDEST}" | awk '{print $1}')
;;
"gs")