@jupyterlab/coreutils
Advanced tools
Comparing version 6.1.0-beta.0 to 6.1.0-beta.1
@@ -68,2 +68,4 @@ import { PartialJSONObject } from '@lumino/coreutils'; | ||
* | ||
* @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted. | ||
* | ||
* #### Notes | ||
@@ -73,3 +75,3 @@ * This function returns `false` for any fully qualified url, including | ||
*/ | ||
function isLocal(url: string): boolean; | ||
function isLocal(url: string, allowRoot?: boolean): boolean; | ||
/** | ||
@@ -76,0 +78,0 @@ * The interface for a URL object |
@@ -126,2 +126,4 @@ "use strict"; | ||
* | ||
* @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted. | ||
* | ||
* #### Notes | ||
@@ -131,6 +133,6 @@ * This function returns `false` for any fully qualified url, including | ||
*/ | ||
function isLocal(url) { | ||
function isLocal(url, allowRoot = false) { | ||
const { protocol } = parse(url); | ||
return ((!protocol || url.toLowerCase().indexOf(protocol) !== 0) && | ||
url.indexOf('/') !== 0); | ||
(allowRoot ? url.indexOf('//') !== 0 : url.indexOf('/') !== 0)); | ||
} | ||
@@ -137,0 +139,0 @@ URLExt.isLocal = isLocal; |
{ | ||
"name": "@jupyterlab/coreutils", | ||
"version": "6.1.0-beta.0", | ||
"version": "6.1.0-beta.1", | ||
"description": "JupyterLab - Core Utilities", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/jupyterlab/jupyterlab", |
@@ -144,2 +144,4 @@ // Copyright (c) Jupyter Development Team. | ||
* | ||
* @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted. | ||
* | ||
* #### Notes | ||
@@ -149,3 +151,3 @@ * This function returns `false` for any fully qualified url, including | ||
*/ | ||
export function isLocal(url: string): boolean { | ||
export function isLocal(url: string, allowRoot: boolean = false): boolean { | ||
const { protocol } = parse(url); | ||
@@ -155,3 +157,3 @@ | ||
(!protocol || url.toLowerCase().indexOf(protocol) !== 0) && | ||
url.indexOf('/') !== 0 | ||
(allowRoot ? url.indexOf('//') !== 0 : url.indexOf('/') !== 0) | ||
); | ||
@@ -158,0 +160,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114582
2771