diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/librefetch/librefetch | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 6268d75..3d7f667 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -119,18 +119,11 @@ main() { local src="${extra_opts[0]}" local dst="${extra_opts[1]:-${src##*/}}" - # canonicalize $src - if [[ "$src" == libre://* ]]; then - src="${MIRROR}/${src#libre://}" - fi - # canonicalize $dst - dst="$(readlink -m -- "$dst")" + # Don't canonicalize $src unless mode =~ download, and we've validated + # that $MIRROR is configured. - # check to see if $src is a candidate for create mode - if [[ "$src" != "$MIRROR"* ]]; then - # inhibit create - mode=download - fi + # Canonicalize $dst + dst="$(readlink -m -- "$dst")" # Mode: download ####################################################### @@ -138,6 +131,17 @@ main() { load_files librefetch check_vars librefetch MIRROR DOWNLOADER || return 1 + # Canonicalize $src + if [[ "$src" == libre://* ]]; then + src="${MIRROR}/${src#libre://}" + fi + + # check to see if $src is a candidate for create mode + if [[ "$src" != "$MIRROR"* ]]; then + # inhibit create + mode=download + fi + local dlcmd="${DOWNLOADER}" dlcmd="${dlcmd//\%o/\"$dst\"}" dlcmd="${dlcmd//\%u/\"$src\"}" |