packages: mailman/mailman.spec, mailman/keep-original-mime-headers.patch (N...

glen glen at pld-linux.org
Fri Aug 27 16:56:45 CEST 2010


Author: glen                         Date: Fri Aug 27 14:56:45 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add keep original attachment headers infofile patch
- fix spool dirs packaging (dirs should be dirs, not files)

---- Files affected:
packages/mailman:
   mailman.spec (1.171 -> 1.172) , keep-original-mime-headers.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/mailman/mailman.spec
diff -u packages/mailman/mailman.spec:1.171 packages/mailman/mailman.spec:1.172
--- packages/mailman/mailman.spec:1.171	Thu Aug 26 18:45:26 2010
+++ packages/mailman/mailman.spec	Fri Aug 27 16:56:40 2010
@@ -3,7 +3,7 @@
 # Conditional build:
 %bcond_with	umbrella_hack	# break anonimization (for use with moderated umbrella list of moderated lists)
 
-%define		rel	5
+%define		rel	5.13
 Summary:	The GNU Mailing List Management System
 Summary(es.UTF-8):	El Sistema de Mantenimiento de listas de GNU
 Summary(pl.UTF-8):	System Zarządzania Listami Pocztowymi GNU
@@ -37,6 +37,7 @@
 Patch10:	%{name}-daemonize-fds.patch
 Patch11:	%{name}-httpauth.patch
 Patch12:	%{name}-MM_FIND_USER_NAME.patch
+Patch13:	keep-original-mime-headers.patch
 URL:		http://www.list.org/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -183,6 +184,7 @@
 %patch10 -p1
 %patch11 -p1
 %patch12 -p1
+%patch13 -p1
 
 # Conflicts with python built-in email package
 sed -i -e 's,EMAILPKG=,#EMAILPKG=,g' misc/Makefile.in
@@ -291,7 +293,7 @@
 rm -rf $RPM_BUILD_ROOT%{_libdir}/mailman/tests
 
 # create dirs to package them
-touch $RPM_BUILD_ROOT%{_queuedir}/{archive,bad,bounces,commands,in,news,out,retry,shunt,virgin}
+install -d $RPM_BUILD_ROOT%{_queuedir}/{archive,bad,bounces,commands,in,news,out,retry,shunt,virgin}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -564,6 +566,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.172  2010/08/27 14:56:40  glen
+- add keep original attachment headers infofile patch
+- fix spool dirs packaging (dirs should be dirs, not files)
+
 Revision 1.171  2010/08/26 16:45:26  glen
 - release 5
 

================================================================
Index: packages/mailman/keep-original-mime-headers.patch
diff -u /dev/null packages/mailman/keep-original-mime-headers.patch:1.1
--- /dev/null	Fri Aug 27 16:56:45 2010
+++ packages/mailman/keep-original-mime-headers.patch	Fri Aug 27 16:56:40 2010
@@ -0,0 +1,59 @@
+save original mime headers from attachment to .raw file and send them back when
+attachment is accessed over cgi. as the logistic of saving attachment with
+filename is quite unreliable, even if the content-types match for input and
+output the filename extension offered may make no sense on client computer.
+
+for example input email has:
+Name: test.rtf
+Type: application/msword
+Size: 17084 bytes
+
+Mailman will detect from mimetype .dot extension:
+python -c 'from mimetypes import guess_all_extensions; print guess_all_extensions("application/msword");'
+['.wiz', '.dot', '.doc']
+
+and save as test.wiz, client will request such file, and will get:
+Content-Type: application/msword
+
+and will save as test.wiz, now client desktop has no ideas how to open .wiz
+file and has to rename file manually to .rtf to actually being able top open it
+with double click.
+
+saving and sending original headers ensures we get original filename that was
+in email. works for private archives but unfortunately as public archives are
+sent out direcly by webserver which we have no control over the extra headers
+to send. (altho if we mod_asis could work here, but that means totally
+incompatible storage from previous versions)
+
+Signed-off-by: Elan Ruusamäe <glen at delfi.ee>
+--- mailman-2.1.13/Mailman/Cgi/private.py~	2010-08-27 14:28:41.000000000 +0300
++++ mailman-2.1.13/Mailman/Cgi/private.py	2010-08-27 14:28:45.036366738 +0300
+@@ -175,6 +175,11 @@
+             f = gzip.open(true_filename, 'r')
+         else:
+             f = open(true_filename, 'r')
++            # if .txt exists, dump it out as it contains extra headers
++            if os.path.exists(true_filename + '.raw'):
++                fh = open(true_filename + '.raw', 'r')
++                sys.stdout.write(fh.read())
++                fh.close()
+     except IOError:
+         msg = _('Private archive file not found')
+         doc.SetTitle(msg)
+--- mailman-2.1.13/Mailman/Handlers/Scrubber.py~	2010-08-27 15:27:27.000000000 +0300
++++ mailman-2.1.13/Mailman/Handlers/Scrubber.py	2010-08-27 15:27:33.452165228 +0300
+@@ -520,6 +520,14 @@
+     fp = open(path, 'w')
+     fp.write(decodedpayload)
+     fp.close()
++
++    # print Content-Type and Content-Disposition we found to .raw for Cgi.private to use
++    f = open(path + '.raw', 'w')
++    for k, v in msg.items():
++        if k.lower() in ['content-type', 'content-disposition']:
++            f.write("%s: %s\n" % (k, v.replace("\n ", " ")))
++    f.close()
++
+     # Now calculate the url
+     baseurl = mlist.GetBaseArchiveURL()
+     # Private archives will likely have a trailing slash.  Normalize.
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mailman/mailman.spec?r1=1.171&r2=1.172&f=u



More information about the pld-cvs-commit mailing list