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

Fix for urls, when a content is responded in JSON format. #8

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

Conversation

andreymoskvenkov
Copy link

No description provided.

@gordonknoppe
Copy link
Owner

Hi @andreymoskvenkov, thanks for the pull request.

Can you share an example of the problem this is trying to fix? Is this for cases where there are json encoded url strings within an HTML formatted body of a response with text/html content-type? Or for parsing JSON responses such as an AJAX controller.

@andreymoskvenkov
Copy link
Author

Oh man....noo....
The problem occurs, when some controller's action sets into response body the json encoded string and no matter what content type will be set into the response objetct (text/html or text/json or something else). Another words the test case is the following:

  1. a customer runs some Ajax action from some page (for example, loading page 2 on a category page).
  2. The Ajax request is being processed by a controller's action method
  3. A controller's action sets into the Response's body a JSON encoded string like:
    $this->getResponse()->setBody(json_encode($result));
  4. Ajax callback method processes it and gets image URLs (if such URLs are present in the response JSON object somewhere) without appended version numbers.

My fix fixes all cases, when a response body is a JSON text.

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.

None yet

2 participants