sindresorhus/refined-github

Code browser and PR diff replace URLs they shouldn't #2482

Vannevelj posted onGitHub

When viewing a PR as well as browsing to the code directly, I'm seeing URLs in the code being replaced by Refined Github. When I do a search for the content that is different, I can see in the search result preview the real content. When I then click on the search result to open the exact file, it shows me the wrong content.

I have verified this is caused by Refined Github as enabling/disabling it makes it work/break. When refreshing the page I can see for a fraction of a second that the first load contained a different diff than what I end up with so I'm certain something is replacing it.

Through trial-and-error I have found that the offending feature is linkify-code. This seems relevant because the code that I am looking at is a dictionary where the keys are URLs:

{ VastTagKeys.VideoEmbeddablePlayer, "http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/xxx/Video_EmbeddablePlayer&ciu_szs&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&correlator=[timestamp]" },

With the feature enabled, this becomes

{ VastTagKeys.VideoEmbeddablePlayer, "[referrer_url]&correlator=[timestamp]" },

Notice how the url ends with &url=[referrer_url]&correlator=[timestamp] -- it feels as if the parsing is going wrong somewhere.

I've disabled the feature for the time being so I'm unblocked on this.


That's what you get by using both doubleclick and an ad blocker. 😁

linkify-urls works correctly but then the ad blocker hides the link.

Works as expected, you'll have to disable your ad blocker.

Reduced demo pastable on: https://npm.runkit.com/linkify-urls (as long as you first disable the ad blocker or linkify-code here)

const linkifyUrls = require("linkify-urls")

linkifyUrls('http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/xxx/Video_EmbeddablePlayer&ciu_szs&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&correlator=[timestamp]')
posted by fregante over 5 years ago

Hah. Good find, that makes sense. Thanks for looking into this.

posted by Vannevelj over 5 years ago

Fund this Issue

$0.00
Funded

Pull requests