From: Art Cancro Date: Fri, 12 Mar 2010 16:58:54 +0000 (+0000) Subject: * Do not reinsert the existing wiki page when uploading an attachment. Fixes bug... X-Git-Tag: v7.86~328 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=fa4b9ccb46c4e66af46179924fd101ada064c3c8 * Do not reinsert the existing wiki page when uploading an attachment. Fixes bug 537. --- 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); + } } }