EUDAT-B2SHARE / b2share

B2SHARE software for the EUDAT CDI services.
https://b2share.eudat.eu
GNU General Public License v2.0
35 stars 32 forks source link

Internal Server Error 500 after two consecutive PATCH requests #1931

Open gcakir opened 3 months ago

gcakir commented 3 months ago

While adding data to the draft, the first PATCH request successfully adds data to the existing draft. But if the same request is made with the identical payload/data (e.g. joe@abc.def) for the same path (e.g. contact_email), Internal Server Error (500) will be returned from the API.

data_patch = [

    {"op": "add", "path": "/contact_email", "value": "joe@abc.def"},

]

This seems to be happening because publication state disappears in https://github.com/EUDAT-B2SHARE/b2share/blob/8834415ae5619fe661bd8bab47383b49c82f691c/b2share/modules/deposit/permissions.py#L323

Could it be that whole block in this part is indented one level less than it should be?

@JohannesLares @hjhsalo

hjhsalo commented 3 months ago

The indent theory has been briefly tested and it seems that fixing indentation fixes the problem. Full unit test suite was not yet run. @gcakir do you want to open a pull request?

gcakir commented 3 months ago

The indent theory has been briefly tested and it seems that fixing indentation fixes the problem. Full unit test suite was not yet run. @gcakir do you want to open a pull request?

Pull request created. :+1: