aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/comment.py
diff options
context:
space:
mode:
Diffstat (limited to 'becommands/comment.py')
-rw-r--r--becommands/comment.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/becommands/comment.py b/becommands/comment.py
index f7459dd..b31a6e7 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -93,9 +93,13 @@ def execute(args, test=False):
raise cmdutil.UserError("No comment entered.")
body = body.decode('utf-8')
elif args[1] == '-': # read body from stdin
- body = sys.stdin.read()
- if not body.endswith('\n'):
- body+='\n'
+ binary = not options.content_type.startswith("text/")
+ if not binary:
+ body = sys.stdin.read()
+ if not body.endswith('\n'):
+ body+='\n'
+ else: # read-in without decoding
+ body = sys.__stdin__.read()
else: # body = arg[1]
body = args[1]
if not body.endswith('\n'):