clowder-framework / clowder

A data management system that allows users to share, annotate, organize and analyze large collections of datasets. It provides support for extensible metadata annotation using JSON-LD and a distribute analytics event bus for automatic curation of uploaded data.
https://clowderframework.org/
University of Illinois/NCSA Open Source License
35 stars 17 forks source link

Moving file within dataset creates duplicate file view #312

Open taywll252 opened 2 years ago

taywll252 commented 2 years ago

Describe the bug When trying to move a file located in a dataset folder to another folder within the same dataset (related to issue 37), a duplicate listing of the same file was produced. The file was shown in the root of a database AND still in the original parent folder.

Since there doesn't seem to be functionality to move between folders of the same dataset, user tried to make a workaround. The idea was to move the file back into the root of the dataset, then move the file into a different folder within the same dataset. Although probably not intended to be used in this way, the user selected the api/datasets/moveBetweenDatasets endpoint.

It seems to be an issue with the api/datasets/{datasetId}/moveBetweenDatasets/{toDataset}/{fileId} endpoint not handling a case where a user tries to move the file into the same dataset.

To Reproduce Steps to reproduce the behavior:

  1. Upload a file to a dataset's folder (or select a file already uploaded to a dataset's folder)

  2. Move the file from the dataset's folder into the root of the dataset using /datasets/{datasetId}/moveBetweenDatasets/{toDataset}/{fileId} (datasetId and toDataset being the same ID)

    e.g. /api/datasets/1/moveBetweenDatasets/1/1234

  3. Check the dataset's root for the file AND check the folder where the file was supposed to be moved from

  4. See error where file is listed in both locations

Expected behavior File is moved from the dataset folder into the root of the dataset, deleting the association with the old parent folder. Only 1 view/location of the file.

Desktop (please complete the following information):

taywll252 commented 6 months ago

I'd actually forgotten I posted this issue until my team encountered this issue again today:

My team recently was using the /api/datasets/{dsID}/moveBetweenDatasets/{newdsID}/{fileID} and /api/datasets/{newdsID}/moveFile/{newfolderID}/{fileID} endpoints to transfer files from one dataset to another and then into a folder in the new dataset. The workflow was tested on 2 files to start.

We noticed that for both cases, the same exact file (same ID) was shown to exist in 2 places (visible through an API pull of the file information and in UI):

  1. File 1 was in the root of the new dataset and in the subfolder. This was resolved in the UI by using the "move" interface to move the root located file into the subfolder, where it seems the duplicate location association collapsed.
  2. File 2 was in the old AND new dataset, where the breadcrumb path actually showed a dropdown for the multiple Spaces which we've never seen before in the UI.

The issue seems to be connected to moveBetweenDatasets because my team has successfully used the "moveFile" endpoint to move files around within a dataset before without issue.

Clowder Version: 1.20.2#889 branch:master sha1:68baf98f0a7635f9059c9856e2fa6b92781e308f