You are here: Foswiki>Tasks Web>Item10665 (17 Dec 2011, GeorgeClark)Edit Attach

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
Reported By: MichaelDaum
Waiting For:
Last Change By: GeorgeClark
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


ItemTemplate edit

Summary can't copy attachments under a different user
ReportedBy MichaelDaum
Codebase 1.1.3, trunk
SVN Range
AppliesTo Engine
Priority Urgent
CurrentState Closed
Checkins distro:b4d2749a2459 distro:f56d8cbdd14e
TargetRelease patch
ReleasedIn 1.1.4
Topic revision: r4 - 17 Dec 2011, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy