Skip to content

Commit 36a332e

Browse files
authored
detect figshare file types
1 parent 692e3a6 commit 36a332e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

earthpy/io.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,14 @@ def get_data(self,
176176
f"Title '{title}' not found in available datasets."
177177
)
178178
urls = self._get_figshare_download_urls(article_id)
179-
this_data = [(url, name, "file") for name, url in urls.items()]
179+
this_data = []
180+
for name, url in urls.items():
181+
# Determine filetype using file name extension
182+
file_type = "file"
183+
for ext in ALLOWED_FILE_TYPES:
184+
if fname.endswith(ext):
185+
file_type = ext
186+
this_data.append((url, name, file_type))
180187

181188
if url is not None:
182189
with requests.head(url) as r:

0 commit comments

Comments
 (0)