Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixtures: insert/replace scenario with files #2150

Open
tiborsimko opened this issue Dec 14, 2017 · 0 comments · May be fixed by #3180
Open

fixtures: insert/replace scenario with files #2150

tiborsimko opened this issue Dec 14, 2017 · 0 comments · May be fixed by #3180

Comments

@tiborsimko
Copy link
Member

PR #2046 imrproved the behaviour of insert, replace, insert-or-replace mode to load records with or without files. It addressed well the main use cases behind #2039.

However, one corner case issue remains with respect to deleting previously uploaded files:

$ ./scripts/clean-instance.sh 
$ ./scripts/populate-instance.sh --skip-records
$ cernopendata fixtures records \
    -f ./cernopendata/modules/fixtures/data/records/cms-tools-vm-image.json \
    --mode insert
$ curl http://0.0.0.0:5000/record/249/files/cms-user-data.txt 
$ curl http://0.0.0.0:5000/record/249/files/cms-user-data.txt 
$ cernopendata fixtures records \
    -f ./cernopendata/modules/fixtures/data/records/cms-tools-vm-image.json \
    --mode replace --skip-files
$ curl http://0.0.0.0:5000/record/249/files/cms-user-data.txt

The detailed record page shows well that there are no files attached anymore, but the file download URL still serves the file content. One would expect to get a 404 not found in this scenario.

Reminder of wanted behaviour:

mode behaviour when PID exists behaviour when PID does not exist
insert fail upload as new
replace update as existing fail
insert or replace update existing upload as new

Both when including files or when excluding files (if -skip-files option was used).

@tiborsimko tiborsimko added this to the Someday milestone Dec 14, 2017
wahaj added a commit to wahaj/opendata.cern.ch that referenced this issue Nov 22, 2021
* Deletes the files and returns a 404 message upon insert or replace
  files when using the --skip-files flag
* Fixes cernopendata#2150
@wahaj wahaj linked a pull request Nov 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant