Actually Hans I believe that both Si and I both expressed support for the other approach and strongly disagree with truncating the filename just in order to create a composite contentName. As I mentioned in my message if we want a field that has all of the information it should NOT be the contentName, it should be the description. The contentName should just be the filename. Rather than start a commit war over this, let's get opinions out on the table and if there is not a consensus everything is okay with, we'll have to vote on it. -David On Jan 29, 2007, at 2:54 AM, [hidden email] wrote: > Author: hansbak > Date: Mon Jan 29 01:54:16 2007 > New Revision: 500985 > > URL: http://svn.apache.org/viewvc?view=rev&rev=500985 > Log: > as discussed in several emails this commit reverts 499102 and > 499122 and makes sure the contentname always contains information > about the attached file > > Modified: > ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ > EmailWorker.java > > Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ > email/EmailWorker.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/ > src/org/ofbiz/content/email/EmailWorker.java? > view=diff&rev=500985&r1=500984&r2=500985 > ====================================================================== > ======== > --- ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ > EmailWorker.java (original) > +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ > EmailWorker.java Mon Jan 29 01:54:16 2007 > @@ -91,7 +91,10 @@ > ) ) > { > String attFileName = part.getFileName(); > - commEventMap.put("contentName", attFileName); > + if (attFileName != null && attFileName.length() > 16) { > + attFileName = attFileName.substring(0,16); > + } > + commEventMap.put("contentName", subject + "-" + > attachmentCount + " " + attFileName); > commEventMap.put("drMimeTypeId", thisContentType); > if (thisContentType.startsWith("text")) { > String content = (String)part.getContent(); > > smime.p7s (3K) Download Attachment |
Sorry, i misunderstood you original message.
I use this piece of code the last few months in production and i have it regularly that either no filename are given, or that more then one time de same filename is given. Secondly filenames are most of the time not longer than 16 characters in email attachments. How about, if no filename is given we put the subjectline in the contentName with a number? Hans On Monday 29 January 2007 17:22, David E. Jones wrote: > Actually Hans I believe that both Si and I both expressed support for > the other approach and strongly disagree with truncating the filename > just in order to create a composite contentName. > > As I mentioned in my message if we want a field that has all of the > information it should NOT be the contentName, it should be the > description. The contentName should just be the filename. > > Rather than start a commit war over this, let's get opinions out on > the table and if there is not a consensus everything is okay with, > we'll have to vote on it. > > -David > > On Jan 29, 2007, at 2:54 AM, [hidden email] wrote: > > Author: hansbak > > Date: Mon Jan 29 01:54:16 2007 > > New Revision: 500985 > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=500985 > > Log: > > as discussed in several emails this commit reverts 499102 and > > 499122 and makes sure the contentname always contains information > > about the attached file > > > > Modified: > > ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ > > EmailWorker.java > > > > Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ > > email/EmailWorker.java > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/ > > src/org/ofbiz/content/email/EmailWorker.java? > > view=diff&rev=500985&r1=500984&r2=500985 > > ====================================================================== > > ======== > > --- ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ > > EmailWorker.java (original) > > +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ > > EmailWorker.java Mon Jan 29 01:54:16 2007 > > @@ -91,7 +91,10 @@ > > ) ) > > { > > String attFileName = part.getFileName(); > > - commEventMap.put("contentName", attFileName); > > + if (attFileName != null && attFileName.length() > 16) { > > + attFileName = attFileName.substring(0,16); > > + } > > + commEventMap.put("contentName", subject + "-" + > > attachmentCount + " " + attFileName); > > commEventMap.put("drMimeTypeId", thisContentType); > > if (thisContentType.startsWith("text")) { > > String content = (String)part.getContent(); -- Regards, Hans Bakker ANT Websystems Co.,Ltd (http://www.antwebsystems.com) If you want to verify that this message really originates from from the above person, download the public key from: http://www.antwebsystems.com/hbakkerAntwebsystems.asc |
Hans Bakker wrote:
> Sorry, i misunderstood you original message. > > I use this piece of code the last few months in production and i have it > regularly that either no filename are given, or that more then one time de > same filename is given. Secondly filenames are most of the time not longer > than 16 characters in email attachments. > > How about, if no filename is given we put the subjectline in the contentName > with a number? > > Hans > > On Monday 29 January 2007 17:22, David E. Jones wrote: > >> Actually Hans I believe that both Si and I both expressed support for >> the other approach and strongly disagree with truncating the filename >> just in order to create a composite contentName. >> >> As I mentioned in my message if we want a field that has all of the >> information it should NOT be the contentName, it should be the >> description. The contentName should just be the filename. >> >> Rather than start a commit war over this, let's get opinions out on >> the table and if there is not a consensus everything is okay with, >> we'll have to vote on it. >> >> -David >> >> On Jan 29, 2007, at 2:54 AM, [hidden email] wrote: >> >>> Author: hansbak >>> Date: Mon Jan 29 01:54:16 2007 >>> New Revision: 500985 >>> >>> URL: http://svn.apache.org/viewvc?view=rev&rev=500985 >>> Log: >>> as discussed in several emails this commit reverts 499102 and >>> 499122 and makes sure the contentname always contains information >>> about the attached file >>> >>> Modified: >>> ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ >>> EmailWorker.java >>> >>> Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ >>> email/EmailWorker.java >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/ >>> src/org/ofbiz/content/email/EmailWorker.java? >>> view=diff&rev=500985&r1=500984&r2=500985 >>> ====================================================================== >>> ======== >>> --- ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ >>> EmailWorker.java (original) >>> +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/email/ >>> EmailWorker.java Mon Jan 29 01:54:16 2007 >>> @@ -91,7 +91,10 @@ >>> ) ) >>> { >>> String attFileName = part.getFileName(); >>> - commEventMap.put("contentName", attFileName); >>> + if (attFileName != null && attFileName.length() > 16) { >>> + attFileName = attFileName.substring(0,16); >>> + } >>> + commEventMap.put("contentName", subject + "-" + >>> attachmentCount + " " + attFileName); >>> commEventMap.put("drMimeTypeId", thisContentType); >>> if (thisContentType.startsWith("text")) { >>> String content = (String)part.getContent(); >>> > > That sounds fine. Let's just have it so that if there is no file name then we'll use contentName + "-" + attachmentCount. I don't think we should truncate the filenames to 16 characters, so could we just leave that one out? Si |
Free forum by Nabble | Edit this page |