Skip to content

Commit

Permalink
use rs_search to improve reporting and prevent dupe uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
dericed committed Apr 7, 2017
1 parent 042f57c commit 01186fd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rs_uploadfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ done
shift $(( ${OPTIND} - 1 ))

_convert_to_full_path(){
echo $(cd $(dirname "${1}"); pwd)/$(basename "${1}")
echo $(cd $(dirname "${1}"); pwd)/$(basename "${1}")
}

_createresource(){
Expand All @@ -43,5 +43,12 @@ while [ "${*}" != "" ] ; do
# get context about the input
INPUT="${1}"
shift
_uploadfile $(_convert_to_full_path "${INPUT}")
RS_ID=$("${SCRIPTDIR}/rs_search" $(basename "${INPUT%.*}"))
if [[ -z "${RS_ID}" ]] ; then
_uploadfile $(_convert_to_full_path "${INPUT}")
RS_ID=$("${SCRIPTDIR}/rs_search" $(basename "${INPUT%.*}"))
echo "$(basename "${INPUT%.*}") is now available at pages/view.php?ref=${RS_ID}"
else
echo "$(basename "${INPUT%.*}") is already represented at pages/view.php?ref=${RS_ID}"
fi
done

0 comments on commit 01186fd

Please sign in to comment.