Skip to content

Commit

Permalink
Add further debug output and fallback mimetpye check
Browse files Browse the repository at this point in the history
  • Loading branch information
asset-web committed Nov 6, 2024
1 parent 7106079 commit 90c8208
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ def _assert_file_is_uploaded_and_extracted_where_required(self, test_archive_fil
self.assertNotContains(response, "is not a plain text file")
self.assertEqual(Upload.objects.all().count(), previous_upload_count + 1)
uploaded_file_path = Upload.objects.all().order_by("id").last().abstracts_upload.path
logger.error(f"uploaded_file_path {uploaded_file_path}")
mime_type = magic.from_file(uploaded_file_path, mime=True)
if mime_type == None:
logger.error(f"uploaded_file_path {uploaded_file_path}")
logger.error(self.driver.page_source)
uploaded_file = Upload.objects.all().order_by("id").last().abstracts_upload.file
mime_type = magic.from_buffer(uploaded_file.read(1024), mime=True)
self.assertEqual(mime_type, "text/plain")

def test_bz2_pub_med_upload_is_allowable(self):
Expand Down

0 comments on commit 90c8208

Please sign in to comment.