Skip to content

Commit aeb6928

Browse files
authored
improve fulltext upload endpoint visibility (#170)
* improve logging for fulltext uploads * improve types for getting fulltext uplodas
1 parent b00f948 commit aeb6928

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

colandr/api/v1/routes/fulltext_uploads.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ class FulltextUploadAPI(MethodView):
4040
},
4141
location="query",
4242
)
43+
@bp.output(
44+
af.schemas.FileSchema(type="string", format="binary"),
45+
content_type="application/pdf",
46+
)
4347
@jwtext.jwt_required()
4448
def get(self, id, query_data):
4549
review_id = query_data["review_id"]
@@ -96,6 +100,8 @@ def get(self, id, query_data):
96100
file_contents = f.read()
97101
return send_file(
98102
io.BytesIO(file_contents),
103+
mimetype="application/pdf",
104+
as_attachment=False,
99105
download_name=os.path.basename(filepath),
100106
)
101107

@@ -180,7 +186,10 @@ def post(self, id, files_data):
180186
db.session.commit()
181187

182188
current_app.logger.info(
183-
'uploaded "%s" for %s', fulltext["original_filename"], study
189+
'uploaded "%s" for %s to "%s"',
190+
fulltext["original_filename"],
191+
study,
192+
filepath,
184193
)
185194

186195
# parse the fulltext text content and get its word2vec vector

0 commit comments

Comments
 (0)