TripalCultivate / TripalCultivate-Phenotypes

Provides generic support for large scale phenotypic data and traits with importers, content pages and visualizations.
GNU General Public License v3.0
1 stars 0 forks source link

[Bug] Changing the extension on a PDF to TXT is not caught by the Importer if OS changes mime/type too #59

Closed laceysanderson closed 7 months ago

laceysanderson commented 9 months ago

Drupal Version

10.1

Tripal Version

4.x dev (most recent commit)

Module Version

4.x dev (most recent commit)

Site Operating System

Debian Linux

Installation Method

TripalDocker docker

Browsers

Firefox

Observations

When I upload a file that is a PDF but has the file ending .txt I expect the importer to give me a validation error but it does not on Mac OS. It seems this is because Mac OS X changes the mime type automatically when you edit the extension 🤦‍♀️

Screenshot 2023-12-08 at 2 06 12 PM Screenshot 2023-12-08 at 2 07 06 PM

Expected Behaviour

I expected to be told that the file was of an unsupported file type.

Steps to Reproduce

  1. Create a fresh docker (including the code in PR #50 if it's not yet merged).
  2. Create an organism
  3. Create a Project
  4. Configure the ontologies for the organism here: http://localhost/admin/tripal/extension/tripal-cultivate/phenotypes/ontology
  5. Use drush php:cli to associate the organism with the project
    \Drupal::service('trpcultivate_phenotypes.genus_project')
    ->setGenusToProject(PROJECT ID, 'GENUS', TRUE);
  6. Navigate to the Pheno Share importer: http://localhost/admin/tripal/loaders/trpcultivate-phenotypes-share (you may need to clear the cache if you get page not found)
  7. Download this sample.pdf or use your own. Open up finder, edit the filename and change the extension from .pdf to .txt
  8. Upload this modified file in the importer form you already opened by clicking the browse, selecting it and then clicking upload.
  9. Click the "Validate Data File" button and notice that the validation passed...

Relevant log output

No response

laceysanderson commented 7 months ago

Fixed by PR