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

Bugfix: Prevent replacing string occurences of extension in filename #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rebeccahum
Copy link

Hi!

Any filenames with the extension in it are being stripped out from this line:

$dst_rel_path = str_replace( '.' . $ext, '', $rel_path );

And thus, fails this check here:

elseif ( file_exists( $destfilename ) && getimagesize( $destfilename ) ) {

E.g. /2019/01/filename.jpg-hello.jpg-test-name.jpg, where all occurrences of jpg become stripped out when only the actual extension at the end of it should be. This patch looks for the last occurrence of the extension at the end and strips it out by position instead.

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

Successfully merging this pull request may close these issues.

1 participant