Skip to content

Commit 946e56b

Browse files
max-zillarobkooper
authored andcommitted
Fix thumbnail upload for v1 files
1 parent 25c3e4d commit 946e56b

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](https://semver.org/).
77

8-
## 3.0.3 - 2023-08-29
8+
## 3.0.4 - 2023-09-27
9+
10+
### Fixed
11+
12+
- Fixed host bug on v1 file thumbnail endpoint.
13+
-
14+
- ## 3.0.3 - 2023-08-29
915

1016
### Added
1117

pyclowder/api/v1/files.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,18 +295,18 @@ def upload_thumbnail(connector, client, fileid, thumbnail):
295295
"""
296296

297297
logger = logging.getLogger(__name__)
298-
url = client.host + 'api/fileThumbnail?key=' + client.key
298+
url = '%s/api/fileThumbnail?key=%s' % (client.host, client.key)
299299

300300
# upload preview
301301
with open(thumbnail, 'rb') as inputfile:
302302
result = connector.post(url, files={"File": inputfile}, verify=connector.ssl_verify if connector else True)
303303
thumbnailid = result.json()['id']
304304
logger.debug("thumbnail id = [%s]", thumbnailid)
305305

306-
# associate uploaded preview with orginal file/dataset
306+
# associate uploaded preview with original file/dataset
307307
if fileid:
308308
headers = {'Content-Type': 'application/json'}
309-
url = client.host + 'api/files/' + fileid + '/thumbnails/' + thumbnailid + '?key=' + client.key
309+
url = '%s/api/files/%s/thumbnails/%s?key=%s' % (client.host, fileid, thumbnailid, client.key)
310310
connector.post(url, headers=headers, data=json.dumps({}), verify=connector.ssl_verify if connector else True)
311311

312312
return thumbnailid

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='pyclowder',
11-
version='3.0.3',
11+
version='3.0.4',
1212
description='Python SDK for the Clowder Data Management System',
1313
long_description=long_description,
1414

0 commit comments

Comments
 (0)