Make the local userfiles 404 if the file is not there. Remove some extraneous logging from the trigger.
This commit is contained in:
parent
be728ceccb
commit
893e5136a0
2 changed files with 4 additions and 2 deletions
|
@ -6,7 +6,7 @@ import magic
|
|||
|
||||
from boto.s3.key import Key
|
||||
from uuid import uuid4
|
||||
from flask import url_for, request, send_file, make_response
|
||||
from flask import url_for, request, send_file, make_response, abort
|
||||
from flask.views import View
|
||||
|
||||
|
||||
|
@ -99,6 +99,9 @@ class UserfilesHandlers(View):
|
|||
|
||||
def get(self, file_id):
|
||||
path = self._userfiles.file_path(file_id)
|
||||
if not os.path.exists(path):
|
||||
abort(404)
|
||||
|
||||
logger.debug('Sending path: %s' % path)
|
||||
return send_file(path, mimetype=self._magic.from_file(path))
|
||||
|
||||
|
|
|
@ -275,7 +275,6 @@ class GithubBuildTrigger(BuildTrigger):
|
|||
tarball_subdir = ''
|
||||
with SpooledTemporaryFile(CHUNK_SIZE) as tarball:
|
||||
for chunk in download_archive.iter_content(CHUNK_SIZE):
|
||||
logger.debug('Writing chunk of size: %s', len(chunk))
|
||||
tarball.write(chunk)
|
||||
|
||||
# Seek to position 0 to make tarfile happy
|
||||
|
|
Reference in a new issue