From 1111b62d12a1df9cbfcc480e3e21e7be554c116d Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 30 Jan 2024 06:22:51 +0200 Subject: Fixed add subcommand bug --- bin/ak-news | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/ak-news b/bin/ak-news index 1b6ff9b..8175aba 100755 --- a/bin/ak-news +++ b/bin/ak-news @@ -90,10 +90,12 @@ import(){ } add2(){ TEMP="$(ak-tempassin)" - cd $TEMP - if [ -f $1 ]; then - FILE="$1" + if [ -f "$1" ]; then + FILE="$(realpath $1)" cp $FILE $ZNEWSDIR + cp $FILE $TEMP + FILE="$(basename $1)" + cd $TEMP echo "Adding news from " $FILE DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') TITLE=$(head -n 1 $FILE) @@ -105,7 +107,7 @@ add2(){ { "datetime":"$DATETIME", "title":"$TITLE", - "filename":"$FILE", + "filename":"$(basename $FILE)", "ipfs":"$FILE_IPFS_HASH", "detach":"$FILE_SIGNATURE" } @@ -122,6 +124,7 @@ EOF echo "error??" exit 1 fi + rm -rf $TEMP } add(){ TEMP="$(ak-tempassin)" -- cgit v1.2.3