• I’ve been struggling with this for about 5 hours now to no avail. No matter what I do, whenever I upload a file the filename gets sanitized for me. In particular all periods except for the last one get removed. This breaks files with two-part extensions. (e.g. ‘.tar.gz’)

    Looking through the code, I found 3 possible suspects:

    sanitize_file_name in formatting.php
    I’ve tried just removing the period replacement code, as well as commenting out the entire function only leaving ‘return $name’, to no avail.

    mw_newMediaObject in xmlrpc.php
    I’ve tried taking out the sanitize_file_name call altogether, with no luck.

    clean_url in formatting.php
    On a whim, I also tried removing the period from the first preg_replace line in clean_url, with no luck. (This actually caused some strange behavior during uploads.)

    So how can I prevent WP from removing periods from my uploads?!

Viewing 2 replies - 1 through 2 (of 2 total)
  • any luck with this? I have the same problem.

    Yes, here is a solution:
    The name of uploaded files gets sanitized by wp_unique_filename() in wp-includes/functions.php. To fix your problem, on line 1154 of functions.php, change sanitize_title_with_dashes to sanitize_file_name. I believe this is a bug in WordPress, as they are using a title sanitize on a filename.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disabling filename sanitizing’ is closed to new replies.