broadinstitute / single_cell_portal_core

Rails/Docker application for the Broad Institute's single cell RNA-seq data portal
https://singlecell.broadinstitute.org
BSD 3-Clause "New" or "Revised" License
62 stars 26 forks source link

Fix validation error when gzipped file lacks proper extension (SCP-5820) #2145

Closed eweitz closed 2 weeks ago

eweitz commented 3 weeks ago

This fixes a misformatted validation error message. It also suggests a better way for the author to fix the problem.

Impact

SCP requires gzipped files to have certain file extensions -- either .gz, .tbi, or .bam. If the gzip-compressed file lacks such an extension, a encoding:missing-gz-extension error is logged, and a human-friendly message should be displayed.

Previously, however, the error message was somewhat mangled. The actionability of the error message also wasn't as useful as it could be. These issues caused confusion -- a user who encountered this wrote into us yesterday for help.

Now, the error message is formatted properly, and the recommendation for the author to fix the problem is clearer.

Demo

Here's how it looks.

https://github.com/user-attachments/assets/130115d1-5f76-4add-953e-e30132e0a784

Test

An automated test protects against regression. Optionally, to manually test:

  1. Go to classic upload UI for a study
  2. Select "test/test_data/validation/missing-gz-extension.txt` (which is gzipped, but lacks a ".gz" file extension)
  3. Confirm error message appears:

    Only files with extensions ".gz", ".bam", or ".tbi" may be gzipped. Please add a ".gz" extension to the file name, or decompress the file, and retry.

This fixes SCP-5820. This is the 1st of 2 PRs related to a user-reported issue with CSFV, RDS files, and gzip. The PRs are split because the fixes address independent aspects of the problem.

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.94%. Comparing base (3ffa262) to head (8d1e927). Report is 4 commits behind head on development.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2145/graphs/tree.svg?width=650&height=150&src=pr&token=HMWE5BO2a4&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute)](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute) ```diff @@ Coverage Diff @@ ## development #2145 +/- ## =============================================== - Coverage 69.96% 69.94% -0.02% =============================================== Files 331 331 Lines 27990 27990 Branches 2452 2452 =============================================== - Hits 19582 19579 -3 - Misses 8262 8265 +3 Partials 146 146 ``` | [Files with missing lines](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2145?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute) | Coverage Δ | | |---|---|---| | [...javascript/lib/validation/validate-file-content.js](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2145?src=pr&el=tree&filepath=app%2Fjavascript%2Flib%2Fvalidation%2Fvalidate-file-content.js&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute#diff-YXBwL2phdmFzY3JpcHQvbGliL3ZhbGlkYXRpb24vdmFsaWRhdGUtZmlsZS1jb250ZW50Lmpz) | `87.84% <100.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2145/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute)