GenSpectrum / cov-spectrum-website

A web platform to detect and analyze variants of SARS-CoV-2
https://cov-spectrum.org
GNU General Public License v3.0
60 stars 14 forks source link

Regression: GISAID accession list no longer opens in new tab #930

Closed corneliusroemer closed 6 months ago

corneliusroemer commented 6 months ago

There seems to be a regression for feature #444 in that the accessions are downloaded rather than opened in new file.

This is probably because there's no longer a downloadAsFile=false URL parameter.

Old link: https://lapis.cov-spectrum.org/gisaid/v1/sample/gisaid-epi-isl?host=Human&region=Europe&dateFrom=2021-09-27&nucMutations=2470T%2C13195C%2CG27382C%2CA29510C%2CC26858T%2CA27383T&downloadAsFile=false&dataFormat=csv

New link: https://lapis.cov-spectrum.org/gisaid/v2/sample/details?country=Switzerland&dateFrom=2023-08-21&dateTo=2024-02-15&nextcladePangoLineage=ba.2.86*&host=Human&dataFormat=CSV-WITHOUT-HEADERS&accessKey=9Cb3CqmrFnVjO3XCxQLO6gUnKPd&fields=gisaidEpiIsl

See https://neherlab.slack.com/archives/C01M74N29RD/p1708616351775129

fengelniederhammer commented 6 months ago

downloadAsFile=false essentially does nothing. I will investigate why this happens...

Did you by any chance also archive what the response for the old link looked like (most importantly the headers)?

corneliusroemer commented 6 months ago

It's just a list of accessions, something like:

EPI_ISL_18861300
EPI_ISL_18832067
EPI_ISL_18763358
EPI_ISL_18782686

I'm not sure I have an archive, let me check!

Unfortunately I couldn't find any full requests in web archive.

fengelniederhammer commented 6 months ago

https://lapis.cov-spectrum.org/open/v1/sample/genbank-accession?dataFormat=csv&limit=100

has content-disposition: inline set. That's likely it.

fengelniederhammer commented 6 months ago

content-disposition: inline doesn't do it. If Content-Type: text/csv or Content-Type: text/tab-separated-values, then browsers refuse to display it and instead download the data.

LAPIS 1 solves this by setting Content-Type: text/plain for those specific endpoints that fetch accession lists.

How should we handle this in LAPIS 2? Our routing depends on the Accept and Content-Type header, so this might be difficult to overwrite. Also we don't have specific endpoints, but abuse /details here.

chaoran-chen commented 6 months ago

It is a useful feature that people use and enjoy, so we should support it.

What's about setting the Content-Type to text/plain for dataFormat=CSV-WITHOUT-HEADERS?

fengelniederhammer commented 6 months ago

What's about setting the Content-Type to text/plain for dataFormat=CSV-WITHOUT-HEADERS?

Sounds like a possible solution. That data format is quite specific for that use case anyway. Or should we introduce yet another data format?

fengelniederhammer commented 6 months ago

I deployed the necessary changes, works for me in Firefox:

grafik

corneliusroemer commented 6 months ago

Excellent, yes works for me too!

image