feat: CSVファイルの判定をContent-Typeから拡張子に変更

This commit is contained in:
shimoda.m@nds-tyo.co.jp 2023-07-31 13:43:21 +09:00
parent e21f7a740e
commit bca73ecec0

View File

@ -137,10 +137,9 @@ async def inst_emp_csv_upload(
# 画面表示用のモデル
error_message_list = []
content_type: str = csv_upload_form.csv_file.content_type.strip()
if csv_upload_form.csv_file.size == 0:
error_message_list.append('選択されたファイルが見つかりませんでした。')
elif content_type != 'text/csv' and content_type != 'application/vnd.ms-excel' and content_type != 'application/octet-stream':
elif not csv_upload_form.csv_file.filename.endswith('.csv'):
error_message_list.append('選択されたファイル形式が"csv"ではありません。')
elif csv_upload_form.csv_file.size >= constants.MENTE_CSV_UPLOAD_MAX_FILE_SIZE_BYTE:
error_message_list.append('選択されたCSVファイルサイズが大きいです。100MB未満にしてください。')