Skip to content

Commit

Permalink
Fixed allow_origin headers on top of metadata headers
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Jun 27, 2017
1 parent e6757b5 commit e990c93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions clam/clamservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def downloader(targetuser, project, type, filename, credentials=None):
return withheaders(flask.make_response('Invalid type',403),headers={'allow_origin': settings.ALLOW_ORIGIN})

if outputfile.metadata:
headers = outputfile.metadata.httpheaders()
headers = dict(list(outputfile.metadata.httpheaders()))
mimetype = outputfile.metadata.mimetype
else:
headers = {}
Expand Down Expand Up @@ -1212,7 +1212,7 @@ def getoutputfile(project, filename, credentials=None): #pylint: disable=too-man
raise flask.abort(404)

if outputfile.metadata:
headers = outputfile.metadata.httpheaders()
headers = dict(list(outputfile.metadata.httpheaders()))
mimetype = outputfile.metadata.mimetype
printdebug("No metadata found for output file " + str(outputfile))
else:
Expand All @@ -1223,8 +1223,8 @@ def getoutputfile(project, filename, credentials=None): #pylint: disable=too-man
#guess mimetype
mimetype = mimetypes.guess_type(str(outputfile))[0]
if not mimetype: mimetype = 'application/octet-stream'
printdebug("Returning output file " + str(outputfile) + " with mimetype " + mimetype)
headers['allow_origin'] = settings.ALLOW_ORIGIN
printdebug("Returning output file " + str(outputfile) + " with mimetype " + mimetype)
try:
return withheaders(flask.Response( (line for line in outputfile) ), mimetype, headers )
except UnicodeError:
Expand Down Expand Up @@ -1387,7 +1387,7 @@ def getinputfile(project, filename, credentials=None):
raise flask.abort(404)

if inputfile.metadata:
headers = inputfile.metadata.httpheaders()
headers = dict(list(inputfile.metadata.httpheaders()))
mimetype = inputfile.metadata.mimetype
else:
printdebug("No metadata found for input file " + str(inputfile))
Expand Down
2 changes: 1 addition & 1 deletion clam/common/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import clam.common.util
import clam.common.viewers

VERSION = '2.1.13'
VERSION = '2.1.14'

#dirs for services shipped with CLAM itself
CONFIGDIR = os.path.abspath(os.path.dirname(__file__) + '/../config/')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def read(fname):

setup(
name = "CLAM",
version = "2.1.13", #also change in clam.common.data.VERSION
version = "2.1.14", #also change in clam.common.data.VERSION
author = "Maarten van Gompel",
author_email = "proycon@anaproy.nl",
description = ("Turns command-line NLP tools into fully-fledged RESTful webservices with an auto-generated web-interface for human end-users."),
Expand Down

0 comments on commit e990c93

Please sign in to comment.