Open taywll252 opened 2 years 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):
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
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:
Upload a file to a dataset's folder (or select a file already uploaded to a dataset's folder)
Move the file from the dataset's folder into the root of the dataset using
/datasets/{datasetId}/moveBetweenDatasets/{toDataset}/{fileId}
(datasetId
andtoDataset
being the same ID)e.g. /api/datasets/1/moveBetweenDatasets/1/1234
Check the dataset's root for the file AND check the folder where the file was supposed to be moved from
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):