Description
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):
- OS: Windows 10
- python 3.7 using API calls
- Clowder Version 1.19.4