Skip to content

Commit

Permalink
Merge pull request #32 from hydroshare/decode-filename
Browse files Browse the repository at this point in the history
Decode filename
  • Loading branch information
sblack-usu authored Nov 16, 2021
2 parents 1d94f4d + bf47ba6 commit 1a1c0e8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion hsclient/hydroshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sqlite3
import tempfile
import time
import urllib.parse
from datetime import datetime
from functools import wraps
from posixpath import basename, dirname, join as urljoin, splitext
Expand Down Expand Up @@ -749,7 +750,7 @@ def retrieve_file(self, path, save_path=""):
file = self.get(path, status_code=200, allow_redirects=True)

cd = file.headers['content-disposition']
filename = cd.split("filename=")[1].strip('"')
filename = urllib.parse.unquote(cd.split("filename=")[1].strip('"'))
downloaded_file = os.path.join(save_path, filename)
with open(downloaded_file, 'wb') as f:
f.write(file.content)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hsmodels == 0.1.6
hsmodels >= 0.4.2
pytest == 6.0.2
requests == 2.24.0
email-validator
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

setup(
name='hsclient',
version='0.1.8',
version='0.2.0',
packages=find_packages(include=['hsclient', 'hsclient.*'],
exclude=("tests",)),
install_requires=[
'hsmodels==0.2.5',
'hsmodels>=0.4.2',
'requests',
'requests_oauthlib',
'pandas'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def test_aggregations(new_resource, files):
"asdf/testing.xml",
"asdf/asdf_resmap.xml",
"asdf/asdf_meta.xml",
], # requires hydrosare updates in bag_ingestion_patches
], # requires hydroshare updates in bag_ingestion_patches
],
)
def test_aggregation_fileset(new_resource, files):
Expand Down

0 comments on commit 1a1c0e8

Please sign in to comment.