Skip to content

Commit

Permalink
LIMS export is UTF-8 encoded
Browse files Browse the repository at this point in the history
  • Loading branch information
mhkc committed Mar 15, 2024
1 parent d628486 commit db343b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/app/blueprints/sample/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Declaration of views for samples"""
import json
from datetime import date
from io import StringIO
from io import BytesIO
from itertools import groupby
from typing import Any, Dict, Tuple

Expand Down Expand Up @@ -213,7 +213,7 @@ def update_qc_classification(sample_id: str) -> str:
)
@login_required
def download_lims(sample_id: str):
"""Download a LIMS compatible file."""
"""Download a LIMS compatible file with UTF-8 encoding."""
# get user auth token
token = TokenObject(**current_user.get_id())

Expand Down Expand Up @@ -241,7 +241,7 @@ def download_lims(sample_id: str):
return redirect(request.referrer)

# convert string to IO buffer
buffer = StringIO(data)
buffer = BytesIO(data.encode('UTF-8'))
response = make_response(buffer.getvalue())
# define headers and mimetype for a file
response.headers["Content-Disposition"] = f"attachment; filename={fname}.tsv"
Expand Down

0 comments on commit db343b7

Please sign in to comment.