About this topic

  • Posted by mtakada 1 year ago. There are 2 posts. The latest reply is from robfelty.
  1. There is a bug in Postie when handling attachment files which have non-ASCII characters in them - the file upload does not succeed and the link HTML gets cut short (no terminating /a). This was also mentioned in this post: http://forum.robfelty.com/topic/problem-with-accented-chars-in-file-name#post-2640

    Here is a fix that makes non-ASCII characters work (by removing them from filenames). A more ideal solution might be to replace accented characters with their ASCII equivalents, if someone wants to write that.

    Here is how to apply the patch:

    In Postie/postie-functions.php - function GetContent

    Add the following:

    // fix filename (remove non-standard characters)
           $filename = preg_replace("/[^\x9\xA\xD\x20-\x7F]/", "", $part->ctype_parameters['name']);

    Before this (note that this code is now using the $filename variable in the link HTML!!):

    $attachments["html"][] = '<a href="' . $file .
                  '" style="text-decoration:none">' . $icon .
                  $filename . '</a>' . "\n";
              if ($cid) {
                $attachments["cids"][$cid] = array($file,
                    count($attachments["html"]) - 1);
              }
            }

    In Postie/postie-functions.php - function postie_handle_upload

    Add this:

    // fix filename (remove non-standard characters)
           $file['name'] = preg_replace("/[^\x9\xA\xD\x20-\x7F]/", "", $file['name']);

    Before this:

    $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );

    Thank you for a great plugin!

  2. Thanks very much for the patch. I have added it into the development version.

    Rob

RSS feed for this topic

Have you read the FAQ?
Have you tried the latest development version (at the bottom)?

Reply

You must log in to post.