Commit c6e1a1d8 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki Committed by Chrysostomos Nanakos
Browse files

pithos: Fail fast while trying to copy an unavailable snapshot.

Check whether an object is available in the storage backend before copying it.
Otherwise, fail with 403 (FORBIDDEN) response status.
parent 1ac442e2
......@@ -1434,6 +1434,10 @@ class ModularBackend(BaseBackend):
is_copy = not is_move and (src_account, src_container, src_name) != (
dest_account, dest_container, dest_name) # New uuid.
if is_copy and not props[self.AVAILABLE]:
raise NotAllowedError('Copying objects not available in the '
'storage backend is forbidden.')
src_mapfile = props[self.MAPFILE]
force_mapfile = src_mapfile if not is_copy else None
......@@ -1491,6 +1495,10 @@ class ModularBackend(BaseBackend):
delimiter) else dest_name
vdest_name = path.replace(prefix, dest_prefix, 1)
if is_copy and not prop[self.AVAILABLE]:
raise NotAllowedError('Copying objects not available in '
'the storage backend is forbidden.')
src_mapfile = prop[self.MAPFILE]
force_mapfile = src_mapfile if not is_copy else None
......
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