The file extension .png will be added only if the file has extensions other than .png or .PNG (#150)

This commit is contained in:
Aaditya Naik 2017-12-12 21:46:10 +05:30 committed by Alex Epstein
parent 103040f2fb
commit 228893ccbd
2 changed files with 10 additions and 1 deletions

View File

@ -87,9 +87,18 @@ makeqr()
# redirects the image obtained from the goqr api into a png file
function makeQRFile {
input=$(echo "$input" | sed -e s/" "/%20/g -e s/'\\n'/%0A/g ) ##same as in the makeqr function
httpGet "api.qrserver.com/v1/create-qr-code/?size=150x150&data=$input" > $fileName.png
addFileExt
httpGet "api.qrserver.com/v1/create-qr-code/?size=150x150&data=$input" > $fileName
}
function addFileExt {
if ! echo "$fileName" | grep -E -q ".*\.png$|.*\.PNG$"
then
fileName="$fileName.png"
fi
}
makeMultiLineQr()
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB