Skip to content

Commit

Permalink
MBS-9188: Improve LinkedIn URL cleanup
Browse files Browse the repository at this point in the history
The subdomain is apparently just for display language and whatnot
but does not change the content nor block it, so we should
standardize to the www. default.
It seems that no ? parameters are useful (seem to be for tracking only)
so we should drop them too.
  • Loading branch information
reosarevok committed May 31, 2022
1 parent 9fbd4e7 commit c8fccfc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion root/static/scripts/edit/URLCleanup.js
Expand Up @@ -2731,7 +2731,8 @@ const CLEANUPS: CleanupEntries = {
match: [new RegExp('^(https?://)?([^/]+\\.)?linkedin\\.com/', 'i')],
restrict: [LINK_TYPES.socialnetwork],
clean: function (url) {
return url.replace(/^https?:\/\/([^/]+\.)?linkedin\.com/, 'https://$1linkedin.com');
url = url.replace(/^https?:\/\/(?:[^/]+\.)?linkedin\.com\/([^?#]+)(?:[?#].*)?$/, 'https://www.linkedin.com/$1');
return url;
},
},
'livefans': {
Expand Down
6 changes: 6 additions & 0 deletions root/static/scripts/tests/Control/URLCleanup.js
Expand Up @@ -2734,6 +2734,12 @@ limited_link_type_combinations: [
expected_relationship_type: 'socialnetwork',
expected_clean_url: 'https://www.linkedin.com/in/legselectric',
},
{
input_url: 'https://ca.linkedin.com/in/didier-charette-0630b1b6?original_referer=https%3A%2F%2Fduckduckgo.com%2F',
input_entity_type: 'artist',
expected_relationship_type: 'socialnetwork',
expected_clean_url: 'https://www.linkedin.com/in/didier-charette-0630b1b6',
},
// livedoor
{
input_url: 'http://blog.livedoor.jp/mintmania/',
Expand Down

0 comments on commit c8fccfc

Please sign in to comment.