buildkite / terminal-to-html

Converts arbitrary shell output (with ANSI) into beautifully rendered HTML
http://buildkite.github.io/terminal-to-html
MIT License
649 stars 45 forks source link

iTerm2 embedded images are broken #25

Closed toolmantim closed 9 years ago

toolmantim commented 9 years ago

So imgcat.sh and the iTerm standard expect the filename to be base64 encoded: http://iterm2.com/images.html#/section/home

$ ./utils/imgcat.sh fixtures/meme.png | less
ESC]1337;File=name=Zml4dHVyZXMvbWVtZS5wbmc=;size=55110;...

But it seems we expect it to be plain text:

$ ./utils/imgcat.sh fixtures/meme.png | terminal-to-html 
*** Error parsing iTerm2 image escape sequence: can't determine content type for "Zml4dHVyZXMvbWVtZS5wbmc=&q

https://github.com/buildkite/terminal/blob/0f479d49667660a99390bfb7a601f50a4e36fe0f/image.go#L44

I believe all we need to do base64 decode the name field value before we set it.

mipearson commented 9 years ago

Ah, dammit. I was sure I tested it with imgcat.sh. Ah well.