Skip to content

Commit

Permalink
KPMP-1930: Use packageID to get files
Browse files Browse the repository at this point in the history
  • Loading branch information
zwright committed Jul 7, 2020
1 parent 0fa4ae7 commit 80e3ed3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
minioUrl = os.environ.get('MINIO_URL')
minioClient = Minio(minioUrl, access_key=minioAccessKey, secret_key=minioSecretKey, secure=False)

@app.route('/v1/file/download/<objectName>', methods=['GET'])
def downloadFile(objectName):
@app.route('/v1/file/download/<packageId>/<objectName>', methods=['GET'])
def downloadFile(packageId, objectName):
try:
object = minioClient.get_object(s3Bucket, objectName, request_headers=None)
objectNameFull = packageId + '/' + objectName
object = minioClient.get_object(s3Bucket, objectNameFull, request_headers=None)
return send_file(object, as_attachment=True, attachment_filename=objectName)
except ResponseError as err:
print(err)
Expand Down

0 comments on commit 80e3ed3

Please sign in to comment.