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

Duplicating post with featured image name in cyrillic doesn't work properly #43

Open
ge-ku opened this issue Sep 18, 2017 · 2 comments
Open

Comments

@ge-ku
Copy link

ge-ku commented Sep 18, 2017

Steps to reproduce:

  1. Rename any image into something that contains cyrillic only, like "гп.jpg".
  2. Upload it to one site and publish a post with this image set as featured.
  3. Duplicate post using this plugin.

It refers to this image simply as ".jpg" and when you publish multiple posts like this it will use same picture everywhere (I guess the first instance of ".jpg", not sure).

Possible solutions:

  1. Support unicode file names.
  2. Transliterate file names into latin.
  3. Use new filenames unique for MPD plugin (like multisite-post-duplicator_i.jpg where "i" is incremented integer).

Thanks for your work on this plugin, hope you can fix it. Let me know if this issue is on my side only.

@ge-ku
Copy link
Author

ge-ku commented Sep 18, 2017

When I echo $filename after $filename = apply_filters('mpd_featured_image_filename', basename($image_details['url']), $image_details); in mpd-functions.php I get .jpg.
$image_details['url'] is /wp-content/uploads/2017/09/\xd0\xb3\xd0\xbf.jpg.

I thought that maybe those backslashes are what causing storing images without filenames. Doing $filename = basename(str_replace('\x', '', $image_details['url'])); however did nothing.

Also, thumbnails work correctly, since they have unique-ish names with appended resoultions at the end.

@ge-ku
Copy link
Author

ge-ku commented Sep 18, 2017

As a temporary fix this worked for me:
$filename = $image_details['id'] . $filename;
It just prepends id to filename, making those empty ".jpg" into something like "14143.jpg". This is not a proper fix as it doesn't preserve original filenames but is good enough for me, still hope you can fix it for real :)

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