-
-
Notifications
You must be signed in to change notification settings - Fork 369
Description
Describe the bug
Download Natural Earth Dataset in WGS84 prints error message.
To reproduce
- Launch wxGUI
- From the Data catalog toolbar launch Download sample project (location) to current GRASS database dialog
- From the dialog sample project choice widget choose Natural Earth Dataset in WGS84
- Hit download button
- On the end of downloading dataset process you get error message which is printed in dialog
Download of https://zenodo.org/records/13370131/files/natural_earth_dataset.zip
failed or file </tmp/grass8-test-18250/tmpds5ohiix/archive.zip> is not a ZIP file
Expected behavior
Download Natural Earth Dataset via wxGUI should work as expected without prints error message.
Screenshots
System description
- Operating System: all
- GRASS GIS version: 8.5.0dev, 8.4.0
GRASS fire_grass6data/demomapset:tmp > g.version -rge
version=8.5.0dev
date=2024
revision=1b9482cae
build_date=2024-11-05
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=ba0a49519
libgis_date=2024-10-31T16:49:36+00:00
proj=9.4.1
gdal=3.8.5
geos=3.12.1
sqlite=3.46.1
GRASS fire_grass6data/demomapset:tmp > python -c "import sys, wx; print(sys.version); print(wx.version())"
3.12.7 (main, Oct 28 2024, 10:22:17) [GCC 13.3.1 20240614]
4.2.1 gtk3 (phoenix) wxWidgets 3.2.2.1
Additional context
Problematic is following code condition (line 173-178) which is not sufficient in case of downloading Natural Earth Dataset in WGS84 ZIP file from the URL https://zenodo.org/records/13370131/files/natural_earth_dataset.zip where the server response returns two headers (content-type: application/octet-stream and content-disposition: attachment; filename=natural_earth_dataset.zip) that identify the ZIP file.
grass/python/grass/utils/download.py
Lines 173 to 178 in 039183d
| if headers.get("content-type", "") != "application/zip": | |
| raise DownloadError( | |
| _( | |
| "Download of <{url}> failed or file <{name}> is not a ZIP file" | |
| ).format(url=source, name=filename) | |
| ) |
Get server response header with Curl (see content-type: application/octet-stream and content-disposition: attachment; filename=natural_earth_dataset.zip header):
test@test:/tmp$ curl -I https://zenodo.org/records/13370131/files/natural_earth_dataset.zip
HTTP/1.1 200 OK
server: nginx
content-type: application/octet-stream
content-length: 121322068
content-security-policy: default-src 'self' fonts.googleapis.com *.gstatic.com data: 'unsafe-inline' 'unsafe-eval' blob: zenodo-broker.web.cern.ch zenodo-broker-qa.web.cern.ch maxcdn.bootstrapcdn.com cdnjs.cloudflare.com ajax.googleapis.com webanalytics.web.cern.ch
x-content-type-options: nosniff
x-download-options: noopen
x-permitted-cross-domain-policies: none
x-frame-options: sameorigin
x-xss-protection: 1; mode=block
content-disposition: attachment; filename=natural_earth_dataset.zip
last-modified: Mon, 30 Sep 2024 01:12:39 GMT
date: Tue, 05 Nov 2024 19:52:51 GMT
link: <https://zenodo.org/api/records/13370131> ; rel="linkset" ; type="application/linkset+json"
x-ratelimit-limit: 133
x-ratelimit-remaining: 130
x-ratelimit-reset: 1730836384
retry-after: 12
permissions-policy: interest-cohort=()
strict-transport-security: max-age=31556926; includeSubDomains
referrer-policy: strict-origin-when-cross-origin
set-cookie: session=957524b09e088504_672a7793.515i9U5MnmVnxk4dRl1PrWhnfH4; Expires=Fri, 15 Nov 2024 19:52:51 GMT; Secure; HttpOnly; Path=/; SameSite=Lax
strict-transport-security: max-age=15768000
x-request-id: 527ed04385d57cc86a58507dc34e454a
set-cookie: 5569e5a730cade8ff2b54f1e815f3670=c41b72347a319657b4b11be06886d96a; path=/; HttpOnly; Secure; SameSite=None
cache-control: private
Server response Content-Type: application/octet-stream header RFC 2046 states in section 4.5.1:
The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data.
Server response Content-Disposition header doc.
