Avoid shortening an already shortened url
This commit is contained in:
parent
fcf9a26626
commit
e6a1c8c62a
|
@ -52,6 +52,13 @@ fi
|
|||
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG − Get URL : URL to be shortened : ${url_to_short}"
|
||||
# ]]]
|
||||
# Ensure the URL wasn't already shortened [[[
|
||||
if printf -- '%s' "${url_to_short}" | grep -q -E -- "${null_service_url}"
|
||||
then
|
||||
printf "${c_redb}%b${c_reset}\n" "Error : The url to be shortened (${url_to_short}) already seems to comes from the 0x0 service (${null_service_url})."
|
||||
exit 1
|
||||
fi
|
||||
# ]]]
|
||||
|
||||
# shorten URL
|
||||
result=$(curl -sF"shorten=${url_to_short}" "${null_service_url}")
|
||||
|
|
Loading…
Reference in New Issue