Skip to content

Commit 49f7d78

Browse files
committed
Fix uploading binary attachments (bz 1496821)
https://bugzilla.redhat.com/show_bug.cgi?id=1496821
1 parent 343760b commit 49f7d78

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

bin/bugzilla

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ def _do_set_attach(bz, opt, parser, args):
929929
if sys.stdin.isatty():
930930
if not opt.file:
931931
parser.error("--file must be specified")
932-
fileobj = open(opt.file)
932+
fileobj = open(opt.file, "rb")
933933
else:
934934
# piped input on stdin
935935
if not opt.desc:

bugzilla/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ def attachfile(self, idlist, attachfile, description, **kwargs):
14811481
attachment was added, we return the single int ID for back compat
14821482
'''
14831483
if isinstance(attachfile, str):
1484-
f = open(attachfile)
1484+
f = open(attachfile, "rb")
14851485
elif hasattr(attachfile, 'read'):
14861486
f = attachfile
14871487
else:

0 commit comments

Comments
 (0)