Skip to content

Infinit redirect loop if filename contains Unicode characters #17

@mersadk

Description

@mersadk

If filename from uploads directory contains Unicode characters, infinite loop will occur.
This happens on Windows, not sure for Linux.

To fix this, two things needs to be changed in class-404-template.php file.

In function get_local_path() replace line
$this->local_path = $requested_path;
with
$this->local_path = urldecode($requested_path);

Then, in function download() add snippet

if(strcasecmp(substr(PHP_OS, 0, 3), 'WIN') == 0){
    $abspath = iconv('UTF-8', 'WINDOWS-1252', $abspath);
}

before line
$saved_image = $wp_filesystem->put_contents.....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions