Item10665: can't copy attachments under a different user
Priority: Urgent
Current State: Closed
Released In: 1.1.4
Target Release: patch
Applies To: Engine
Component:
Branches:
This is an error in the Foswiki::Meta class. The copyAttachment() function allows to do that operation
overriding the currently logged in user with another optional user, e.g. calling it like
$fromMeta->copyAttachment("image.gif", $toMeta, user => "SomeUserID");
However this fails halting the server in a deadlock.
The
copyAttachment()
method creates an atomic lock for the given user "SomeUserID" and will afterwards
try to create yet another atomic lock as part of the
saveAs()
operation. This normally all comes out fine
_as long as you do not use the
user=>"SomeUserID"
override feature. Otherwise the second try to lock
the topic is done using with the current user id in
saveAs()
which not necessarily equals "SomeUserId" provided to
copyAttachment()
.
The fix is to pass the
user=>"SomeUserID"
override down to the
saveAs()
call part of the copy action.
(... which for
saveAs()
must be a
author=>"SomeUserID"
option ...)
--
MichaelDaum - 21 Apr 2011