[SVN] Mail.tmBundle: Base 64 Encoding Patch

Jonathan Hohle jonhohle at gmail.com
Tue Nov 9 22:36:22 UTC 2010


Howdy,

I'm not sure what the patch submission process is, but I have a small fix
attached.

The Mail bundle's Encode Base 64 Line/Selection command does not propertly
handle multiline input. This may be an issue with the underlying Ruby pack
implementation, which only appears to work on the first string in the array,
and calling #to_a on a string splits it at the \n character. (I've tried
multiple Ruby versions on different OSes and all all fail on multiline input
when using String#to_a).

Input:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque gravida nulla non ante venenatis dictum. Cum
sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Curabitur id nibh eu tortor porta
tincidunt nec elementum metus.


Expected Result:

TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBp
c2NpbmcgZWxpdC4KUXVpc3F1ZSBncmF2aWRhIG51bGxhIG5vbiBhbnRlIHZl
bmVuYXRpcyBkaWN0dW0uIEN1bQpzb2NpaXMgbmF0b3F1ZSBwZW5hdGlidXMg
ZXQgbWFnbmlzIGRpcyBwYXJ0dXJpZW50IG1vbnRlcywKbmFzY2V0dXIgcmlk
aWN1bHVzIG11cy4gQ3VyYWJpdHVyIGlkIG5pYmggZXUgdG9ydG9yIHBvcnRh
CnRpbmNpZHVudCBuZWMgZWxlbWVudHVtIG1ldHVzLg==


Actual Result:

TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBp
c2NpbmcgZWxpdC4K


Result After Patch:

TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBp
c2NpbmcgZWxpdC4KUXVpc3F1ZSBncmF2aWRhIG51bGxhIG5vbiBhbnRlIHZl
bmVuYXRpcyBkaWN0dW0uIEN1bQpzb2NpaXMgbmF0b3F1ZSBwZW5hdGlidXMg
ZXQgbWFnbmlzIGRpcyBwYXJ0dXJpZW50IG1vbnRlcywKbmFzY2V0dXIgcmlk
aWN1bHVzIG11cy4gQ3VyYWJpdHVyIGlkIG5pYmggZXUgdG9ydG9yIHBvcnRh
CnRpbmNpZHVudCBuZWMgZWxlbWVudHVtIG1ldHVzLg==


Wrapping the return string in an array instead of using the result of #to_a
works as expected. Here's the patch:

Index: Mail.tmbundle/Commands/Encode Base 64 Line : Selection.plist
===================================================================
8c8
< <string>${TM_RUBY:-ruby} -e 'print STDIN.read.to_a.pack("m*")'</string>
---
> <string>${TM_RUBY:-ruby} -e 'print [STDIN.read].pack("m*")'</string>


Is there a way to get this patched in the TM Bundle trunk?

Please let me know if I can provide any more information.

Jon Hohle
jonhohle at gmail.com
<><
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20101109/d6971e9b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: encode-base-64-fix.patch
Type: application/octet-stream
Size: 290 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate-dev/attachments/20101109/d6971e9b/attachment.patch>


More information about the textmate-dev mailing list