janimo / textsecure

TextSecure client package for Go
GNU General Public License v3.0
129 stars 26 forks source link

Sending attachments doesn't work #15

Closed fd0 closed 9 years ago

fd0 commented 9 years ago

First: Thanks a lot for your project!

I've tested it and it fails sending attachments:

$ ./textsecure -to handy -attachment=$HOME/pic.jpg
parse https://textsecure-service.whispersystems.org:443/v1/attachments/%!d(string=): invalid URL escape "%!d"

Looks like a wrong format string somewhere.

janimo commented 9 years ago

Thanks for the catch ! This was a regression due to a cleanup with no tests done afterwards :)

fd0 commented 9 years ago

Hey, thanks for the fast response!

With bb9b7763b4c3e47af7e332d41e748ed484ad7aff, something returns HTTP 404:

$ ./textsecure -to handy -attachment=$HOME/pic.jpg
HTTP error 404

Is that expected?

janimo commented 9 years ago

does sending a message ( -to handy -message hello) work?

fd0 commented 9 years ago

yes, that works great.

janimo commented 9 years ago

with yesterday's commit sending an attachment to TextSecure on Android works fine for me. The error you see seems to be at https://github.com/janimo/textsecure/blob/master/server.go#L120 but getPreKeys() is used for sending regular messages too, not just attachments. Try passing both -message and -attachment on the command line, let's see if the text gets through.

fd0 commented 9 years ago

Oh wow, I'm sorry, that was caused by PEBKAC. I've renamed my contact from handy to something different. Using a name from contactl.yml works great, with and without message.

I think it'd be good to verify that the recipient is either a name that could be resolved to a number with contacts.yml, or that it is a phone number, i.e matches \+[0-9]+.

janimo commented 9 years ago

Agreed, the error messages on poorly given contact should be better. The library itself only knows about phone numbers, and the app (in this case the simple cmdline client) handles the tel<->contact names matching.