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

Develop anton #443

Merged
merged 5 commits into from
Feb 21, 2020
Merged

Develop anton #443

merged 5 commits into from
Feb 21, 2020

Conversation

antonkorotkov
Copy link
Contributor



// maybe disable the filter
add_filter('sanitize_file_name', array( $this, 'sanitize_file_name' ), 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have used stateless_skip_cache_busting filter instead. Returning true will short-circuit the randomize_filename function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll check that filter. But don't understand now what exactly will short-circuit. Can you give an example?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see now what you mean short-circuit. Will implement using that filter, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alimuzzaman I think there is some bug in this line https://github.com/wpCloud/wp-stateless/blob/a93638abe0d2ae5013e0c7f6f7155e8e101c0c33/lib/classes/class-utility.php#L80

It should return $filename but not $return. If you return $return then the result of the randomize_filename function will be 1 (casted from true)

Can you confirm this?

Copy link
Contributor

@alimuzzaman alimuzzaman Feb 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, for the confusion. you should return unmodified $filename from the filter, not true. Then $return will become $filename.
I wrote like that so you can modify it from the filter if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, for the confusion. you should return unmodified $filename from the filter, not true. Then $return will become $filename.
I wrote like that so you can modify it from the filter.

Ok, makes sense. Better to keep it as is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add documentation in stateless_skip_cache_busting filter.

*
* @return bool
*/
public static function isCallStackMatches( $callstack, $conditions ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool

@antonkorotkov antonkorotkov merged commit 9f8043d into latest Feb 21, 2020
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.

2 participants