Skip to content

Commit 6c18c50

Browse files
toddntcnichol
authored andcommitted
when uploading previews, metadata cannot be posted unless a section_id is included in the metadata. Since section_id is not required for preview metadata in clowder, this changes the requirement that section_id must be present to post metadata.
Also, if metadata is sent to upload_preview without a section_id, an error is thrown because the method checks for section_id key and it is not present. changelog entry added Updated changelog. fixed per Sandeep's comment check for section_id key in previewmetadata in collections.upload_preview Updated changelog.
1 parent 5f20e20 commit 6c18c50

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG.md

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

7-
## Unreleased
7+
## [Unreleased]
8+
### Changed
9+
- files.upload_preview and collections.upload_preview does not require section_id for metadata [CATS-935](https://opensource.ncsa.illinois.edu/jira/browse/CATS-935)
810

911
### Added
1012
- Docker compose file for starting up the Clowder stack [BD-2226](https://opensource.ncsa.illinois.edu/jira/browse/BD-2226)
@@ -38,4 +40,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3840
- Now has onbuild version of pyclowder
3941
- release.sh will now tag images (e.g. this will be tagged 2.0.3 2.0 and 2)
4042
- RABBITMQ_URI is now set to amqp://guest:guest@rabbitmq/%2F to allow easy deployment
41-
using docker-compose of clowder
43+
using docker-compose of clowder

pyclowder/collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def upload_preview(connector, host, key, collectionid, previewfile, previewmetad
137137
logger.debug("preview id = [%s]", previewid)
138138

139139
# associate uploaded preview with original collection
140-
if collectionid and not (previewmetadata and previewmetadata['section_id']):
140+
if collectionid and not (previewmetadata and 'section_id' in previewmetadata and previewmetadata['section_id']):
141141
url = '%sapi/collections/%s/previews/%s?key=%s' % (host, collectionid, previewid, key)
142142
result = requests.post(url, headers=headers, data=json.dumps({}),
143143
verify=connector.ssl_verify if connector else True)

pyclowder/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def upload_preview(connector, host, key, fileid, previewfile, previewmetadata, p
222222
logger.debug("preview id = [%s]", previewid)
223223

224224
# associate uploaded preview with orginal file
225-
if fileid and not (previewmetadata and previewmetadata['section_id']):
225+
if fileid and not (previewmetadata and 'section_id' in previewmetadata and previewmetadata['section_id']):
226226
url = '%sapi/files/%s/previews/%s?key=%s' % (host, fileid, previewid, key)
227227
result = connector.post(url, headers=headers, data=json.dumps({}),
228228
verify=connector.ssl_verify if connector else True)

0 commit comments

Comments
 (0)