Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command never returns if title contanins space #130

Open
anirudhsanthosh opened this issue Apr 17, 2021 · 6 comments
Open

command never returns if title contanins space #130

anirudhsanthosh opened this issue Apr 17, 2021 · 6 comments
Labels

Comments

@anirudhsanthosh
Copy link

Screenshot_2021-04-17-19-37-02-65_84d3000e3f4017145260f7618db1d683
Screenshot_2021-04-17-19-36-21-83_84d3000e3f4017145260f7618db1d683
Screenshot_2021-04-17-19-36-07-12

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

@ghost
Copy link

ghost commented Apr 17, 2021

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

@ghost ghost transferred this issue from termux/termux-packages Apr 17, 2021
@ghost ghost added the bug label Apr 17, 2021
@agnostic-apollo
Copy link
Member

@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?

@ghost
Copy link

ghost commented Apr 19, 2021

I haven't wrote these scripts but I assume they were just "quick implementation" without care about argument passing safety etc.

@agnostic-apollo
Copy link
Member

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.

@cessywauu
Copy link

Ano, pravděpodobně by to mělo být v budoucnu opraveno.

A místo použití gazillionových echopříkazů k tisku catpomocné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 a README, a zjevně vypadá mnohem čistší. To také ovlivňuje termux-packages.

@anirudhsanthosh
Copy link
Author

anirudhsanthosh commented Sep 30, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants