From 7b3f9929cba16da56f011ba666ca336b1cad2b28 Mon Sep 17 00:00:00 2001 From: Juergen Daubert Date: Sat, 1 Nov 2008 18:17:44 +0100 Subject: [PATCH] Bug #336: Only accept http/https/ftp/file protocols in sources. --- pkgmk.in | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgmk.in b/pkgmk.in index 00d8e95..9fdf768 100755 --- a/pkgmk.in +++ b/pkgmk.in @@ -34,13 +34,11 @@ error() { } get_filename() { - local FILE="`echo $1 | sed 's|^.*://.*/||g'`" - - if [ "$FILE" != "$1" ]; then - FILE="$PKGMK_SOURCE_DIR/$FILE" + if [[ $1 =~ ^(http|https|ftp|file)://.*/(.+) ]]; then + echo "$PKGMK_SOURCE_DIR/${BASH_REMATCH[2]}" + else + echo $1 fi - - echo $FILE } get_basename() { -- 2.26.2