Comment 2 for bug 778464

Revision history for this message
Fredrik-lysholm (fredrik-lysholm) wrote :

So for us still clinging to 10.04 you can edit /usr/bin/xdg-email by your selfs...

May I also suggest allowing correct processing of links where for example body and subject is not always in lowercase ? This can be done by adding the -i flag to grep and do a s/^subject=/subject=/i via sed.

Furthermore, since I often stumble upon emails written with @ replaced with (at) and . with (dot), which actually displays correctly using chromium, I added support for this via this line:

    TO=$(echo "$TO" | sed 's/\s*(dot)\s*/./g' | sed 's/\s*(at)\s*/@/');

My changes to allow for non-lower case "body=" etc. in mailto URLs:

    MAILTO=$(echo "$MAILTO" | sed 's/&/\n/g')
    TO=$(echo "$MAILTO" | grep '^to=' -i | sed 's/^to=//' | awk '{ printf "%s,",$0 }')
    CC=$(echo "$MAILTO" | grep '^cc=' -i | sed 's/^cc=//' | awk '{ printf "%s,",$0 }')
    BCC=$(echo "$MAILTO" | grep '^bcc=' -i | sed 's/^bcc=//' | awk '{ printf "%s,",$0 }')
    SUBJECT=$(echo "$MAILTO" | grep '^subject=' -i | tail -n 1 | sed 's/^subject=/subject=/i')
    BODY=$(echo "$MAILTO" | grep '^body=' -i | tail -n 1 | sed 's/^body=/body=/i')
    ATTACH=$(echo "$MAILTO" | sed 's/^attach=/\n\nfile:\/\//gi' | awk '/^file:/ { printf "%s,",$0 }')
    ATTACH=$(echo "$ATTACH" | sed 's/,$//')

Note the -i flag passed to grep and the sed to replace non-lowercase keys which is also need.