bcicen / slackcat

CLI utility to post files and command output to slack
http://slackcat.chat
MIT License
1.22k stars 57 forks source link

Uploaded binary files corrupted #55

Closed tomgoren closed 6 years ago

tomgoren commented 6 years ago
cat prince-charles.jpg | slackcat -c my_favorite_channel -n prince-charles.jpg

This works supposedly, but after downloading I get a corrupted file.

screen shot 2017-12-05 at 2 52 03 pm

It even recognizes the file type.

I suspect that this is due to us using bufio.ScanLines but I don't know diddly about Golang.

Thanks!

bcicen commented 6 years ago

@tomgoren you are correct that ScanLines is the culprit -- since binary files can be directly uploaded when provided as an argument, it was originally assumed that any piped input would be plaintext.

There's no good reason not to read input as bytes in this circumstance though(i.e. if --stream mode is not enabled), so this change has been made and is available in the latest release

tomgoren commented 6 years ago

Awesome - thanks @bcicen !!! ❤️

tomgoren commented 6 years ago

Confirmed - it is fixed!

screen shot 2017-12-06 at 11 36 48 am