PR#1290: downloadTaskOutput fix for py3
Merges #1290 https://pagure.io/koji/pull-request/1290 Fixes: #1289 https://pagure.io/koji/issue/1289 downloadTaskOutput doesn't work on py3 hub
This commit is contained in:
commit
3a1e9a9328
1 changed files with 5 additions and 2 deletions
|
|
@ -9214,7 +9214,7 @@ class RootExports(object):
|
|||
if not os.path.isfile(filePath):
|
||||
raise koji.GenericError('no file "%s" output by task %i' % (fileName, taskID))
|
||||
# Let the caller handler any IO or permission errors
|
||||
with open(filePath, 'r') as f:
|
||||
with open(filePath, 'rb') as f:
|
||||
if isinstance(offset, str):
|
||||
offset = int(offset)
|
||||
if offset != None and offset > 0:
|
||||
|
|
@ -9222,7 +9222,10 @@ class RootExports(object):
|
|||
elif offset != None and offset < 0:
|
||||
f.seek(offset, 2)
|
||||
contents = f.read(size)
|
||||
return base64.encodestring(contents)
|
||||
if six.PY2:
|
||||
return base64.encodestring(contents)
|
||||
else:
|
||||
return base64.encodestring(contents).decode()
|
||||
|
||||
listTaskOutput = staticmethod(list_task_output)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue