termux-api-package
termux-api-package copied to clipboard
command never returns if title contanins space
Problem description
if the value title option in command contains white space the command never returns
Steps to reproduce
termux-share -a send -t "ueueue ejejje ejeie" proccessedVideos/1618662889.mp4
Expected behavior
the command should be executed and show a chooser activity but it doesnt Additional information
i tried updating and upgrading termux api, apt, even updated app
but it still exist
please check the time and command i used in termux i waited for 1 minute but it is not working
That's a termux-api
script bug as it doesn't handle arguments properly.
https://github.com/termux/termux-api-package/blob/master/scripts/termux-share#L36-L51
@xeffyr I was looking at various termux-api-package
scripts and noticed params and even whole commands were being added to string variables, why weren't bash arrays used? Was it just a poor design decision from the start that has continued on or was it something else?
I haven't wrote these scripts but I assume they were just "quick implementation" without care about argument passing safety etc.
Yeah, probably, should be fixed in future I guess.
And instead of using a gazillion echo
commands to print help text, a simple literal cat
heredoc can be used like here. Would make it easier to write and update the text, no escaping required for like double quotes and for preventing variable expansion, also easier to see/maintain the 70-80 character column width for termux, also help text can be directly copied to somewhere else like a README
, and obviously looks much cleaner. This also affects termux-packages
.
Ano, pravděpodobně by to mělo být v budoucnu opraveno.
A místo použití gazillionových
echo
příkazů k tiskucat
pomocného textu lze použít jednoduchý doslovný heredoc jako zde . Usnadnilo by to psaní a aktualizaci textu, není třeba unikat pro dvojité uvozovky a pro zabránění variabilnímu rozšiřování, také snadněji vidět/udržovat šířku sloupce 70-80 znaků pro termuxy, také pomoci text lze přímo zkopírovat jinam jako aREADME
, a zjevně vypadá mnohem čistší. To také ovlivňujetermux-packages
.
this is how i did the workaround
/data/data/com.termux/files/usr/libexec/termux-api Share --es action send --ez default-receiver true --es title "__YOUR TITLE__" --es file "$(realpath __path to file__)"
i am not good with bash right now so i directly invoked the api binary it works fine exept if you have a double quot in your title