From 80e3ed323b846203899a2af61d8aab8480a5f54c Mon Sep 17 00:00:00 2001 From: Zach Wright Date: Tue, 7 Jul 2020 16:10:52 -0400 Subject: [PATCH] KPMP-1930: Use packageID to get files --- app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 813ed99..4749140 100644 --- a/app.py +++ b/app.py @@ -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/', methods=['GET']) -def downloadFile(objectName): +@app.route('/v1/file/download//', 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)