[
https://issues.apache.org/jira/browse/SLING-8186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16741954#comment-16741954
]
Bertrand Delacretaz commented on SLING-8186:
--------------------------------------------
The following sequence (executed with the attached patch applied) demonstrates
how the attached patch does not solve the "unwanted delete" problem, it simply
fixes it for the specific example of this ticket but moves it to other cases:
{code:java}
# create two test nodes
$ curl -u admin:admin -F title="To keep" http://localhost:8080/test/tokeep
$ curl -u admin:admin -F title="Other" http://localhost:8080/test/other
$ curl -s -u admin:admin -D - http://localhost:8080/test/other.json | head -1
HTTP/1.1 200 OK
$ curl -s -u admin:admin -D - http://localhost:8080/test/tokeep.json | head -1
HTTP/1.1 200 OK
# move /test/other to /test/moved/dest
curl -u admin:admin -F'./moved/dest@MoveFrom=/test/other'
-F'./tokeep@Delete=true' http://localhost:8080/test
# now /test/moved/dest is fine but /test/tokeep is gone
$ curl -s -u admin:admin -D - http://localhost:8080/test/moved/dest.json | head
-1
HTTP/1.1 200 OK
$ curl -s -u admin:admin -D - http://localhost:8080/test/tokeep.json | head -1
HTTP/1.1 404 Not Found
{code}
So I don't think changing the order of operations helps.
The only change that we _might_ make is to disable the "delete a Resource if a
property is not found by @Delete" behavior, but that would not be backwards
compatible.
At this point I think if any changes are desired we need to discuss on dl-dev
so that people with various use cases can chime in.
My preference is to just update the docs at
[https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html]
to warn about these potential unwanted deletes, without changing code.
> Moved node is deleted if @Delete parameter points to its name
> -------------------------------------------------------------
>
> Key: SLING-8186
> URL: https://issues.apache.org/jira/browse/SLING-8186
> Project: Sling
> Issue Type: Bug
> Components: Servlets
> Affects Versions: Servlets Post 2.3.26
> Reporter: Burkhard Pauli
> Assignee: Bertrand Delacretaz
> Priority: Major
> Attachments: patch.diff
>
>
> If a file is moved to a new location with the @MoveFrom parameter and the
> request contains the @Delete parameter at the same time, the file is dropped
> and never saved to the new location.
> Step to reproduce the issue:
> # Create a node of type nt:file at the location {{/content/file}}
> # Execute the following curl command:
> {{curl -u admin:admin -F './test/title=Hello World' -F
> './test/file@MoveFrom=/content/file' -F './test@Delete=true'
> [http://localhost:4502/content]}}
> Observed behaviour:
> The file is not saved at the new location at {{/content/test/file}} and it
> is not available anymore at the old location {{/content/file}}
> Expected:
> The file is saved at the new location {{/content/test/file}} as long as
> other properties are saved when the request contains the delete operation
> (like the title property in the example above).
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)