Skip to content

Commit

Permalink
Merge pull request #175 from bird-house/fix-174
Browse files Browse the repository at this point in the history
Only switch to dods mimetype if supported
  • Loading branch information
huard authored Mar 11, 2020
2 parents f6f68a0 + cd17486 commit 41f490d
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 41f490d

Please sign in to comment.