copy_to_arrange API: Specifying an invalid path within /arrange/ dumps files into the root
|Assignee:||Sarah Romkey||% Done:|
|Google Code Legacy ID:||Pull Request:|
If the "destination" parameter to the SIP arrange /filesystem/copy_to_arrange API is an invalid (non-extant) path within /arrange/, then all of the copied files will be dumped directly into the root of the arrange tree instead. this results in files which don't actually belong to a new SIP.
For example, a bug in the appraisal tab resulted in a request to send files to a destination of "L2FycmFuZ2UvdW5kZWZpbmVk" (that is, "/arrange/undefined"). Screenshot of the final result is attached.
#1 Updated by Misty De Meo over 6 years ago
It looks like the actual bug is slightly different.
Because the destination path did not end with a trailing slash, it was assumed to be a directory and the last component was removed, leading to a target path of `/arrange/`:
# If drop onto a file, drop it into its parent directory instead if not destination.endswith('/'): destination = os.path.dirname(destination)
An extra complication is the special handling of the "objects" directory, which will never be moved over:
# If dragging objects/ folder, actually move the contents of (not # the folder itself) if leaf_dir == 'objects': arrange_path = os.path.join(destination, '')
The result is that all of the contents of the objects directory are dumped directly into /arrange/, which would have been impossible if they were dragged over directly.