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 outlink encode issue #7786

Closed

Conversation

saleemkce
Copy link
Contributor

Fix for issue #5014

It initially took almost one and a half hours to debug the issue and finally got the bug. I wanted to fix this issue because I have had great experience working with urlencode/decode functions in OSIpage in the past so I thought it would be easy for me to debug the issue.

Misconceptions assumed when debuggin:

1, Tried to add meta charset="UTF-8" to head section in HTML page. Didn't help
2, Tried to add script type="text/javascript" charset="text/html;UTF-8" in Piwik script inclusion tag in the hope that it will force page to accept any language character. Didn't help.
3. Inspected Jquery's anchor tag that was bound to DOM when user clicked the outbound link. The dom's href tag was perfect, it contained correct URL with another garbled URL in DOM node (this was updated by our own code)
4. So dug all the related link processing functions and found the line responsible for creating the garbled URL,

sourceElement.href.replace(originalSourceHostName, sourceHostName);

and replaced with,

href.replace(originalSourceHostName, sourceHostName);

5, Thus, all links are now correctly stored in DB and in admin pages.

Some screenshots to enjoy (I used OSIpage developement code to reproduce outbound links),

url-garbage-console-view

[end user page when clicking outbound links, check correct Arabic URL in console]

outlinks-display
[Correct URL (Arabic, Chinese) display in admin pages]

One consideration
when committing, I found warning: LF will be replaced by CRLF in piwik.js.. I don't have clear idea how to make sure correct line ending should be propagated to remote repo. Please cross-check it.

Please comment if anything is wrong.

@mattab
Copy link
Member

mattab commented Apr 29, 2015

Hi @saleemkce thanks for the Pull request. Click on "Files" you will see your commit for this pull request, as you can see it includes your other commits from other pull requests. maybe you created your change in the same branch? if you create a different branch for each PR it should help you. also check out this guide: http://developer.piwik.org/guides/contributing-to-piwik-core#hacking-piwik

let us know how you go, or if you have any question!

@saleemkce saleemkce closed this Apr 30, 2015
@saleemkce saleemkce deleted the bugfix-outlink-encode-issue branch April 30, 2015 18:42
@saleemkce
Copy link
Contributor Author

I find some recurring merge-commit issues. For now, I have deleted all inconsistent pull requests for this issue. I will do this later. I feel quite sorry and embarrassed about not being able to give clean PR now.

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