Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1695: properly encodes hover links
- Loading branch information
Showing
4 changed files
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
export function encodeUrl(url: string): string; | ||
export function encodeUrl(url: string | undefined): string | undefined; | ||
export function encodeUrl(url: string | undefined): string | undefined { | ||
if (url == null) return undefined; | ||
|
||
// Not a fan of this, but it's hard to gauge previous encoding and this is the most common case | ||
url = url.replace(/%20/g, ' '); | ||
return encodeURI(url).replace(/#/g, '%23'); | ||
} |