mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 17:23:10 -05:00
check for encoded components (#18231)
* check for encoded components * address comments * relocate and simplify test * move encodeUrl to notebookLinkHandler * added comments * add containsEncodedUri to network.ts
This commit is contained in:
14
src/sql/base/common/network.ts
Normal file
14
src/sql/base/common/network.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Checks if the specified URL is already URI-encoded by checking if there are any unencoded reserved URI component characters
|
||||
* (such as ?, =, &, /, etc.) in the URL. See https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent for more details.
|
||||
* @returns true if the URL contains encoded URI component reserved characters
|
||||
*/
|
||||
export function containsEncodedUriComponentReservedCharacters(url: string): boolean {
|
||||
// ie ?,=,&,/ etc
|
||||
return (decodeURI(url) !== decodeURIComponent(url));
|
||||
}
|
||||
Reference in New Issue
Block a user