Commit 4565543b authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

plankton: Check that object is an image

Fix bug that caused Plankton to return Pithos files that were not
registered as images. Plankton did not checked that the requested Pithos
object (UUID or URL) was an Image. This was caused because
'get_object_meta' call of PithosBackend returns the common metadata for
all Pithos files (uuid, size, etc.) even if the file had no metadata in
the Plankton domain.
parent 28fc1c5f
......@@ -182,10 +182,12 @@ class ImageBackend(object):
meta = self._get_meta(image_url, version)
meta["deleted"] = timestamp
# XXX: Check that an object is a plankton image! PithosBackend will
# return common metadata for an object, even if it has no metadata in
# plankton domain. All images must have a name, so we check if a file
# is an image by checking if they are having an image name.
if PLANKTON_PREFIX + 'name' not in meta:
logger.warning("Image without Plankton name! url %s meta %s",
image_url, meta)
meta[PLANKTON_PREFIX + "name"] = ""
raise ImageNotFound
permissions = self._get_permissions(image_url)
return image_to_dict(image_url, meta, permissions)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment