[Pharo-project] patched MIMEDocument>>contentType:content:
Hi there, in order to be able to load SIXX 0.95 from universal installer I've needed to unelegantly patch it (a pharo 413) to: contentType: aString content: content "create a MIMEObject with the given content-type and content" "MIMEObject contentType: 'text/plain' content: 'This is a test'" | ans idx | ans := self new. ans privateContent: content. "parse the content-type" (aString isNil or: [ idx := aString asString indexOf: $/. idx = 0]) ifTrue: [ ans type: (MIMEType main: 'application' sub: 'octet-stream')] ifFalse: [ ans type: (MIMEType main: (aString asString copyFrom: 1 to: idx-1) sub: (aString asString copyFrom: idx+1 to: aString asString size))]. ^ans sebastian
Hi sebastian do you mean that the content may not be a string and that converting it would be better? Stef
in order to be able to load SIXX 0.95 from universal installer I've needed to unelegantly patch it (a pharo 413) to:
contentType: aString content: content "create a MIMEObject with the given content-type and content" "MIMEObject contentType: 'text/plain' content: 'This is a test'"
| ans idx | ans := self new. ans privateContent: content.
"parse the content-type" (aString isNil or: [ idx := aString asString indexOf: $/. idx = 0]) ifTrue: [ ans type: (MIMEType main: 'application' sub: 'octet-stream')] ifFalse: [ ans type: (MIMEType main: (aString asString copyFrom: 1 to: idx-1) sub: (aString asString copyFrom: idx+1 to: aString asString size))].
^ans
sebastian
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (2)
-
Sebastian Sastre -
Stéphane Ducasse