b2share icon indicating copy to clipboard operation
b2share copied to clipboard

Internal Server Error 500 after two consecutive PATCH requests

Open gcakir opened this issue 1 year ago • 2 comments

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. [email protected]) 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": "[email protected]"},

]

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

gcakir avatar Apr 30 '24 14:04 gcakir

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?

hjhsalo avatar May 03 '24 10:05 hjhsalo

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:

gcakir avatar May 07 '24 13:05 gcakir