1
Solved

https://tasker.helprace.com/i1793-http-get-variables-cannot-handle-line-breaks not solved

Hello, closing an issue is frustrating and very unhelpful when the problem was not solved because I can no longer reply to it.

https://tasker.helprace.com/i1793-http-get-variables-cannot-handle-line-breaks

The problem is when an SMS has LINE BREAKS, e.g. more than 1 line, only the 1st line is fed into %evtprm3. url encode CANNOT solve the problem. please fix to copy all lines into %evtprm3

3 replies

G

Can you please test using the official version listed which is 6.3.13

G

My text/image dialog shows the multi line SMS correctly. So that leaves the text: in the HTTP Request Query Parameters not URL encoding the line breaks properly.

Can you please try on telegram to see the problem?

G
·

I capture this broken request at my HTTP server logs

```

GET /?Line2Your%20SMS%20OTP%20is%20ABCDEF.%20Please%20enter%20within%202%20minutes%20and%20never%20share%20your%20OTP%20with%20anyone.%20Sent=%2028%2F09%2F2024%2011%3A57%20PM%20******.&text=%5B**SMSRN**%5D%20Line1&chat_id=-111111111

```

Tasker is shifting the 2nd rows to the front without proper assignment to a variable... no wonder everything goes missing. Please fix. Thank you.

Hi. Thanks for the extra info! Can you please clarify what you mean by "Tasker is shifting the 2nd rows to the front without proper assignment to a variable"? I don't understand what you mean by that. Thanks in advance!

G
·

# APACHE LOGS

EXPECTED: GET /?text=line1%0Aline2%0Aline3&chat_id=11111111

ACTUAL: GET /?line2%0Aline3&text=line1&chat_id=11111111

It is very hard to provide readable logs here... do you have a github repo to report issues???
If you still can't follow, please try and setup an apache server and check the logs.
G
·

hello, how is it? the ACTUAL is malformed, why it is like that, I have no idea.. but quite certain it is something in tasker

G
·

hi how often is this checked??? Not daily???

G
·

hello?

G
·

hi?

I just tried this test task to call my own local server and it worked correctly. Does it work for you? can you please try this simple example? Thanks

Task: Test

A1: Variable Set [
Name: %text
To: line1
line2
Structure Output (JSON, etc): On ]

A2: Variable Convert [
Name: %text
Function: URL Encode
Mode: Default ]

A3: HTTP Request [
Method: GET
URL: http://192.1.1.1:8080/test.html
Query Parameters: text:%text
Timeout (Seconds): 30
Structure Output (JSON, etc): On ]

A4: Text/Image Dialog [
Title: response
Text: %http_data
Close After (Seconds): 30 ]

I got this in my server logs:

[2024-10-17T09:22:04.643Z] "GET /test.html?text=line1%250Aline2" "Tasker/6.4.0-beta (Android/15)"

G
·

My version is 6.3.13, how to get 6.4.0 beta?

G
·

https://tasker.joaoapps.com/download.html

Android 5 And Above 5.0+ 6.3.13

Can you please test using the official version listed which is 6.3.13??

But did you try my example? Did it not work with your version of Tasker? You can download the latest version here: https://drive.google.com/open?id=1YGuMAWRfyYlUKMdgb4xyVEUfddWz_zzI&usp=drive_fs

G
·

Why do I feel that you suspect I did not try? Without access to your BETA version, how will we ever get the same results? It would have been much better if you ask youself whether you tried it on the OFFICIAL VERSION of 6.3.13 and %evtprm3

SAME PROBLEM HAPPENING ON 6.4.0 BETA

STOP using %text and URL Encode, we gone through that already and there was no problem. The problem happens when using %evtprm3. SEE MY EXACT SETUP SCREENSHOT sent 1 month ago

PLEASE READ THROUGH THE WHOLE CONVERSATION HERE AGAIN https://tasker.helprace.com/i1827-https-tasker-helprace-com-i1793-http-get-variables-cannot-handle-line-breaks-not-solved

G
·

image-1729659540979.png

1. HTTP Request in telegram will URL ENCODE text and chat_id

2. So we cannot use Variable Convert to URL ENCODE first

3. For some SMS, %evtprm3 HAS LINE BREAKS

4. So, I re-create %evtprm3 in the red box of my screenshot (Line1,2,3)

5. When send to telegram, only Line1 appears, Line2 and Line3 MISSING

Which point you think I'm wrong?

You can't simply put text on separate lines in the "Query Parameters" field. It doesn't work that way. You say that Telegram already URL Encodes the parameters, but if that was the case, they wouldn't show up with new lines like that.

Can you please let me know what you get if you show %evtprm3 in a flash action? thanks

G
·

Yes, I can't put text on separate lines. But that is precisely what your %evtprm3 is doing... that's why this issue remains unresolved.

image-1729764540510.png

%evtprm3 using Text/Image dialog

............ see all the line breaks now???

G
·

image-1729764954169.png

And the FLASH for good measure..........

G
·

4 months since i reported the issue...

I don't understand why you say you can't URL encode %evtprm3... If it's on different lines, that means that it's not URL encoded. Can you please clarify?

G
·

YOUR HTTP REQUEST EXPECTS AN UNENCODED %evtprm3.

IF I ENCODE IT, IT IS DOUBLE ENCODING THEN HTTP REQUEST SCREW UP.

WHAT YOU WANT ME TO CLARIFY?

ARE YOU TELLING ME AFTER FLASH %evtprm3, you STILL CANNOT SEE THE PROBLEM?!?!??????

I DO NOT CONTROL %evtprm3, IT IS PROVIDED BY YOUR TASKER. I FLASH the variable AS-IS.

YOUR HTTP REQUEST CANNOT ACCEPT MULTI LINE %evtprm3, THIS IS THE PROBLEM! FIX IT!

Ok, I fixed it. Here you go:

https://drive.google.com/file/d/1YGuMAWRfyYlUKMdgb4xyVEUfddWz_zzI/view

I'm so sorry if I caused any harm.

Oh, sorry about that. I thought that you had just missed the URL Encode option.

What happens if you use URL encode? What error do you get? Thanks

G
·

Your %evtprm3 is already URL encoded, if I URL encode again, it becomes double encoded, human unreadable.

After much testing, I'm quite sure of the problem already, %evtprm3 is discarding everything after the 1st line. It should be an issue in tasker. Please check the code.

Thanks. I just tried it and it did work for me.

image-1727186023147.png

I used this profile:

Profile: Show received SMS
Event: Received Text [ Type:Any Sender:* Content:* SIM Card:* MMS Body:* ]

Enter Task: Anon

A1: Text/Image Dialog [
Title: New SMS from %evtprm2
Text: %evtprm3
Button 1: ok
Close After (Seconds): 30 ]

Can you please try it to see what happens for you?

G
·

hi i have found the root cause, please help fix

G
·

hello, please confirm my findings thank you

G
·

hi can fix? thanks

G
·

how?

Topic is closed for comments