From: Art Cancro Date: Thu, 14 Dec 2023 15:29:02 +0000 (-0500) Subject: view_mail.js: don't list attachments in a quote or forward X-Git-Tag: v997~72 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=ea50862e0afd4eb85c98c4b735601c0b213fa081 view_mail.js: don't list attachments in a quote or forward --- diff --git a/webcit-ng/server/upload.c b/webcit-ng/server/upload.c index 3c40d9fed..f917f9a49 100644 --- a/webcit-ng/server/upload.c +++ b/webcit-ng/server/upload.c @@ -24,6 +24,11 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, } u.id[sizeof(u.id)-1] = 0; + syslog(LOG_DEBUG, + "upload_handler: name=%s, filename=%s, partnum=%s, disp=%s, cbtype=%s, cbcharset=%s, length=%ld, encoding=%s, cbid=%s", + name, filename, partnum, disp, cbtype, cbcharset, length, encoding, cbid + ); + safestrncpy(u.filename, filename, sizeof(u.filename)); safestrncpy(u.content_type, cbtype, sizeof(u.content_type)); u.length = length; @@ -65,6 +70,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, JsonArrayAppend(j_uploads, j_one_upload); } + // upload handler void upload_files(struct http_transaction *h, struct ctdlsession *c) { // FIXME reject uploads if we're not logged in @@ -150,6 +156,21 @@ struct uploaded_file pop_upload(char *id) { // so the attachments don't have to be sent out to the browser and back. void load_attachments_from_message(struct http_transaction *h, struct ctdlsession *c, char *name) { syslog(LOG_DEBUG, "\033[33mload_attachments_from_message: method is \033[35m%s\033[33m, name is \033[33m%s\033[0m", h->method, name); + + char buf[1024]; + StrBuf *Body = NULL; + + ctdl_printf(c, "MSG2 %ld", atol(name)); + ctdl_readline(c, buf, sizeof buf); + if (buf[0] != '1') { + do_404(h); + return; + } + + while (ctdl_readline(c, buf, sizeof buf), strcmp(buf, "000")) { + // do something + } + do_405(h); } diff --git a/webcit-ng/static/js/view_mail.js b/webcit-ng/static/js/view_mail.js index 6d6fbcf45..4e7635f04 100644 --- a/webcit-ng/static/js/view_mail.js +++ b/webcit-ng/static/js/view_mail.js @@ -216,8 +216,8 @@ function mail_render_one(msgnum, msg, target_div, include_controls) { ""; // end header } - // Display attachments, if any are present - if (msg.part) { + // Display attachments, if any are present (don't do this if we're quoting the message) + if ( (msg.part) && (include_controls) ) { let display_attachments = 0; for (let r=0; r