Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinit redirect loop if filename contains Unicode characters #17

Open
mersadk opened this issue May 28, 2019 · 0 comments
Open

Infinit redirect loop if filename contains Unicode characters #17

mersadk opened this issue May 28, 2019 · 0 comments

Comments

@mersadk
Copy link

mersadk commented May 28, 2019

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.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant