Bug #8957

copy_to_arrange API: Specifying an invalid path within /arrange/ dumps files into the root

Added by Misty De Meo over 6 years ago. Updated almost 5 years ago.

Status:QA/ReviewStart date:09/11/2015
Priority:MediumDue date:
Assignee:Sarah Romkey% Done:

0%

Category:SIP Arrange
Target version:-
Google Code Legacy ID: Pull Request:
Sponsored:No Requires documentation:

Description

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.

Screen Shot 2015-09-11 at 6.40.09 PM.png - Bad tree structure (87.4 KB) Misty De Meo, 09/11/2015 09:40 PM

History

#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.

#2 Updated by Misty De Meo over 6 years ago

  • Status changed from New to Code Review

#3 Updated by Misty De Meo over 6 years ago

  • Status changed from Code Review to QA/Review
  • Assignee set to Holly Becker

#4 Updated by Nick Wilkinson almost 5 years ago

  • Assignee changed from Holly Becker to Sarah Romkey

Also available in: Atom PDF