Re: That old "Don't know how to display application/OCTET-STREAM attachments. Try Save."

Dave Forrest <[email protected]>
Newsgroups gmane.mail.pine.general
Message-ID <[email protected]>
I use a script to run file on the attachment and then call various display 
programs as defined.  I also use this script to decode the pesky things included 
in t-nef attachments.

The script looks like this:

#!/bin/sh
# Converts octet-stream to display calls
# Borrowed from James Budiono 6/15/06 from Hyla Fax List posting
# D. R. Forrest 6/15/06 revised for my application
# DRF 3/9/07 updated  and clarified added more types.

FILETYPE=`file "$1" | cut -d ":" --fields=2- | awk '\
  /Microsoft Office/ { print "office"};\
  /PDF/ {print "pdf"};\
  /(ASCII|shell script)/ {print "ascii"};\
  /PostScript/ {print "ps"};\
  /(Microsoft ASF|Motion JPEG|MPEG|ISO Media)/ {print "video";next};\
  /JPEG|GIF/ {print "jpg"}; '`

#echo $FILETYPE  # for debuging

if [ "$FILETYPE" = "office" ] ; then
     #if it's MS-Office group, then use ooffice
     /bin/echo " "
/usr/bin/ooffice "$1"

elif [ "$FILETYPE" = "pdf" ] ; then
     #if it is PDF, then display it
     /bin/echo " "
/usr/local/bin/evince "$1"

elif [ "$FILETYPE" = "ascii" ] ; then
     #if it's a text file or shell script, show it in an editor
     /bin/echo " "
/usr/bin/gedit  "$1"

elif [ "$FILETYPE" = "ps" ] ; then
     #if it's postscript, display it
      /bin/echo " "
     /usr/bin/evince "$1"

elif [ "$FILETYPE" = "jpg" ] ; then
 	# display it
 	/bin/echo " "
 	/usr/bin/eog "$1"

elif [ "$FILETYPE" = "video" ] ; then
     #if it's a video, play it
      /usr/local/bin/mplayer "$1"

elif [ "$FILETYPE" = "" ] ; then
 	/bin/echo " "
 	echo -e "Don't know how to handle $1.\n"
 	file "$1"
 	sleep 5
 	exit 1

fi
exit


If you'd like to see the t-nef roller, just ask.

Dave


On Fri, 20 Apr 2007, S.A. Birl wrote:

> Hi all:
>
>
> PC-Pine 4.63 this time.
>
> Can someone explain to me (again) why, after editing mailcap.sam with
>
> application/octet-stream;E:\Installers\IrfanView\i_view32.exe %s
> application/*;E:\Installers\IrfanView\i_view32.exe %s
> */*;E:\Installers\IrfanView\i_view32.exe %s
>
>
> and restarting PC-Pine, I still cant open a JPG mis-labeled as
> application/octet-stream?
>
> I suppose it's a security precaution?
>
>
> I was hoping that mailcap would have taken care of this.
>
>
> (Failing that, I need a way to scan incoming attachments for incorrect
> MIME types and fix them on the fly.  But I suppose that's a procmail-
> or-someother fix for my Solairs 9 box to perform.)
>
>
> Thanks
> Birl
>
> ---
> Please do not CC me responses to my own posts.
> I'll read the responses on the list.
>
> (I use UNIX Pine to read local mail; rarely to read IMAP mail.)
> ---
> _______________________________________________
> Pine-info mailing list
> [email protected]
> http://mailman1.u.washington.edu/mailman/listinfo/pine-info
>

-- 
David Forrest                     e-mail   [email protected]
Maple Park Development Corporation  http://www.maplepark.com
St. Louis, Missouri
_______________________________________________
Pine-info mailing list
[email protected]
http://mailman1.u.washington.edu/mailman/listinfo/pine-info
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.