Skip to content

moving a locked file overwriting an other locked files moves the lock from source to destination file #34387

@individual-it

Description

@individual-it

Steps to reproduce

  1. lock "textfile1.txt" and "textfile2.txt"
    curl -u uu1:uu1 -X LOCK "http://localhost/owncloud-core/remote.php/dav/files/uu1/textfile1.txt" -d "<?xml version='1.0' encoding='UTF-8'?><d:lockinfo xmlns:d='DAV:'> <d:lockscope><d:exclusive/></d:lockscope><d:owner>lock fom textfile1</d:owner></d:lockinfo>" | xmllint --format -
      <d:locktoken>
        <d:href>opaquelocktoken:f900492b-47b3-4f69-9374-9dc2c3a8779f</d:href>
      </d:locktoken>
      <d:owner>lock fom textfile1</d:owner>

curl -u uu1:uu1 -X LOCK "http://localhost/owncloud-core/remote.php/dav/files/uu1/textfile2.txt" -d "<?xml version='1.0' encoding='UTF-8'?><d:lockinfo xmlns:d='DAV:'> <d:lockscope><d:exclusive/></d:lockscope><d:owner>lock fom textfile2</d:owner></d:lockinfo>" | xmllint --format -

      <d:locktoken>
        <d:href>opaquelocktoken:95ece69c-fa1e-4faf-9c6b-8c103981d2ed</d:href>
      </d:locktoken>
      <d:owner>lock fom textfile2</d:owner>
  1. move "textfile2.txt" to "textfile1.txt" by supplying both tokens
    curl -u uu1:uu1 -X MOVE "http://localhost/owncloud-core/remote.php/dav/files/uu1/textfile2.txt" -H "Destination: http://localhost/owncloud-core/remote.php/dav/files/uu1/textfile1.txt" -H "If: (<opaquelocktoken:95ece69c-fa1e-4faf-9c6b-8c103981d2ed>) (<opaquelocktoken:f900492b-47b3-4f69-9374-9dc2c3a8779f>)"
  2. check the lock on "textfile1.txt"
    curl -u uu1:uu1 -X PROPFIND http://localhost/owncloud-core/remote.php/webdav/textfile1.txt -d "<?xml version='1.0' encoding='UTF-8'?> <d:propfind xmlns:d='DAV:'> <d:prop><d:lockdiscovery/></d:prop> </d:propfind>" | xmllint --format -

Expected behaviour

token of "textfile1.txt" is preserved
https://tools.ietf.org/html/rfc4918#section-7.6:

A successful MOVE request on a write locked resource MUST NOT move
the write lock with the resource. However, if there is an existing
lock at the destination, the server MUST add the moved resource to
the destination lock scope.

Actual behaviour

            <d:locktoken>
              <d:href>opaquelocktoken:95ece69c-fa1e-4faf-9c6b-8c103981d2ed</d:href>
            </d:locktoken>
            <d:owner>lock fom textfile2</d:owner>
          </d:activelock>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions