Skip to content

Commit

Permalink
only switch to dods mimetype if supported
Browse files Browse the repository at this point in the history
  • Loading branch information
huard committed Mar 11, 2020
1 parent f6f68a0 commit cd17486
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Change History
**************

0.6.8 (2020-03-10)
0.6.9 (2020-03-10)
==================

Changes:
Expand Down
7 changes: 4 additions & 3 deletions birdy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def _encode(content, mimetype, encoding):


def guess_type(url, supported):
"""Guess the mime type of the file link. If the mimetype is not recognized, default to the first supported value.
"""Guess the mime type of the file link.
If the mimetype is not recognized, default to the first supported value.
Parameters
Expand All @@ -148,11 +149,11 @@ def guess_type(url, supported):
# -------------

# netCDF
if mime == "application/x-netcdf" and "dodsC" in url:
if mime == "application/x-netcdf" and "dodsC" in url and "application/x-ogc-dods" in supported:
mime = "application/x-ogc-dods"

# ZIP
zips = ["application/zip", "application/x-zipped-shp"]

if mime not in supported:
if mime in zips and set(zips).intersection(supported):
mime = set(zips).intersection(supported).pop()
Expand Down

0 comments on commit cd17486

Please sign in to comment.