From 3bcbfa3b3d5f2aaead68caea649187abc7a53e8d Mon Sep 17 00:00:00 2001 From: Jay Greguske Date: Thu, 21 Oct 2010 17:05:32 -0400 Subject: [PATCH] allow getfile to handle files > 2G --- hub/kojihub.py | 11 ++++++----- www/kojiweb/index.py | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hub/kojihub.py b/hub/kojihub.py index 04b3a75e..6b42e934 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -6746,11 +6746,12 @@ class RootExports(object): raise koji.GenericError, 'no file "%s" output by task %i' % (fileName, taskID) # Let the caller handler any IO or permission errors f = file(filePath, 'r') - if isinstance(offset, int): - if offset > 0: - f.seek(offset, 0) - elif offset < 0: - f.seek(offset, 2) + if isinstance(offset, str): + offset = int(offset) + if offset != None and offset > 0: + f.seek(offset, 0) + elif offset != None and offset < 0: + f.seek(offset, 2) contents = f.read(size) f.close() return base64.encodestring(contents) diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py index 3e67f9be..11306bd4 100644 --- a/www/kojiweb/index.py +++ b/www/kojiweb/index.py @@ -709,7 +709,11 @@ def getfile(req, taskID, name, offset=None, size=None): chunk_size = 1048576 if remaining < chunk_size: chunk_size = remaining + if offset > 2147483647: + offset = str(offset) content = server.downloadTaskOutput(taskID, name, offset=offset, size=chunk_size) + if isinstance(offset, str): + offset = int(offset) if not content: break req.write(content)