diff --git a/securedrop/journalist_app/api.py b/securedrop/journalist_app/api.py index fe3b4e3686..221cb028ab 100644 --- a/securedrop/journalist_app/api.py +++ b/securedrop/journalist_app/api.py @@ -267,7 +267,8 @@ def all_source_replies(source_uuid): raise e return jsonify({'message': 'Your reply has been stored', - 'uuid': reply.uuid}), 201 + 'uuid': reply.uuid, + 'filename': reply.filename}), 201 @api.route('/sources//replies/', methods=['GET', 'DELETE']) diff --git a/securedrop/tests/test_journalist_api.py b/securedrop/tests/test_journalist_api.py index c89a92424d..acc03b2c53 100644 --- a/securedrop/tests/test_journalist_api.py +++ b/securedrop/tests/test_journalist_api.py @@ -652,6 +652,9 @@ def test_authorized_user_can_add_reply(journalist_app, journalist_api_token, reply = Reply.query.filter_by(uuid=str(reply_uuid)).one_or_none() assert reply is not None + # check that the filename is present and correct (#4047) + assert response.json['filename'] == reply.filename + with journalist_app.app_context(): # Now verify everything was saved. assert reply.journalist_id == test_journo['id'] assert reply.source_id == source_id