mangalam-research / wed

Wed is a web-based editor that assists users in editing XML documents according to a schema.
http://mangalam-research.github.io/wed/
Mozilla Public License 2.0
24 stars 10 forks source link

The ajax saver issues an incorrect If-Match when there is nothing that needs matching. #23

Closed lddubeau closed 7 years ago

lddubeau commented 7 years ago

When dealing with a new file, the initial_etag passed to the Ajax saver is an empty string. Unfortunately, the saver then builds If-Match: "" from this and sends it with the next save request, which is wrong. There should not be any precondition set if initial_etag is empty.

Django 1.10 and earlier used to treat If-Match: "" as if there were no precondition. In other words, the bug in the Ajax saver did not cause any issues when Django 1.10 and earlier was used to respond to the request, and that's why the bug remained undiscovered. Django 1.11 validates If-Match differently and started causing a problem. The issue can be worked around on Django by writing a custom middleware that deletes If-Match if it has the value "".

The plan is to have this fixed in version 0.30.

lddubeau commented 7 years ago

Implemented. The fix will be in 0.30.