Skip to content

Commit

Permalink
Merge pull request #76 from coursehero/remove-carriage-return
Browse files Browse the repository at this point in the history
Remove carriage returns to avoid sending error
  • Loading branch information
Chikashi-Kato committed Apr 12, 2021
2 parents dd1d4e7 + 4335249 commit 3e8edf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions slacktee.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ function send_message()
{
message="$1"

# Remove carriage returns
message=`echo $message | tr -d '\r'`

# Its a blank message, ignore
if [[ $message == "-- $title --\n" ]]; then
return
Expand Down
8 changes: 6 additions & 2 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# - Test set of slacktee.sh -

# Test settings
SLACKTEE="/bin/bash ../slacktee.sh"
DATA="./test_data.txt"
TEST_DIR=`dirname ${BASH_SOURCE[0]}`
SLACKTEE="/bin/bash ${TEST_DIR}/../slacktee.sh"
DATA="${TEST_DIR}/test_data.txt"
CHANNEL="sandbox"
SUB_CHANNEL="sandbox2"

Expand Down Expand Up @@ -217,4 +218,7 @@ echo $long_message | $SLACKTEE -p # should be split up over two messages
# echo $long_message | $SLACKTEE --streaming
# echo $long_message | $SLACKTEE

# Test 27: Carriage return should be removed
echo -e "\rcarriage \rreturn\r" | $SLACKTEE

echo "Test is done!"

0 comments on commit 3e8edf9

Please sign in to comment.