From fa4b9ccb46c4e66af46179924fd101ada064c3c8 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 12 Mar 2010 16:58:54 +0000 Subject: [PATCH] * Do not reinsert the existing wiki page when uploading an attachment. Fixes bug 537. --- webcit/msg_renderers.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 9f35f8673..03b819152 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -833,12 +833,18 @@ void tmplput_EDIT_WIKI_BODY(StrBuf *Target, WCTemplputParams *TP) long msgnum; StrBuf *Buf; - msgnum = locate_message_by_uid(BSTR("page")); - if (msgnum >= 0L) { - Buf = NewStrBuf(); - read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime); - StrBufAppendTemplate(Target, TP, Buf, 1); - FreeStrBuf(&Buf); + /* Insert the existing content of the wiki page into the editor. But we only want + * to do this the first time -- if the user is uploading an attachment we don't want + * to do it again. + */ + if (!havebstr("attach_button")) { + msgnum = locate_message_by_uid(BSTR("page")); + if (msgnum >= 0L) { + Buf = NewStrBuf(); + read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime); + StrBufAppendTemplate(Target, TP, Buf, 1); + FreeStrBuf(&Buf); + } } } -- 2.30.2