Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function resolveSchema(root, ref) {
/* jshint validthis: true */
var p = URI.parse(ref)
, refPath = _getFullPath(p)
, baseId = getFullPath(this._getId(root.schema));
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
var id = normalizeId(refPath);
var refVal = this._refs[id];
if (typeof refVal == 'string') {
return resolveRecursive.call(this, root, refVal, p);
} else if (refVal instanceof SchemaObject) {
if (!refVal.validate) this._compile(refVal);
root = refVal;
} else {
refVal = this._schemas[id];
if (refVal instanceof SchemaObject) {
if (!refVal.validate) this._compile(refVal);
if (id == normalizeId(ref))
return { schema: refVal, root: root, baseId: baseId };
function download(url, spinnerID, spinners) {
// if url scheme is undetected, slap an http in front and retry
if (!uri.parse(url).scheme) {
return download('http://' + url, spinnerID, spinners)
}
// GET request promise
return axios
.get(url)
.then(success => {
spinners.success(spinnerID)
return [spinnerID, success]
})
.catch(err => {
// follow redirects
if (300 < err.status && err.status < 400) {
return download(err.headers.location, spinnerID, spinners)
}
spinners.error(spinnerID)
get_authorization_redirect_uri(uri) {
const plugin = this;
const query = {};
if (plugin.config.redirect_uri) {
uri = plugin.config.redirect_uri;
} else {
// set this in the /oauth/callback endpoint manually to avoid sending non-standard params to providers
// ie: okta pukes when it sees this
query[HANDLER_INDICATOR_PARAM_NAME] = "authorization_callback";
}
const parsedURI = URI.parse(uri);
if (Object.keys(query).length) {
parsedURI.query = queryString.stringify(query);
}
return URI.serialize(parsedURI);
}
url: (asset) => {
// TODO pass in request URL and make it absolute.
if (asset.search === '' && asset.absolutePath !== '.' && asset.relativePath !== '.') {
return `${asset.relativePath}`;
}
return asset.url;
},
}));
// Join the paths
combinedDetails.path = slash(path.join(u1Details.path, u2Details.path));
// Join query parameters
combinedDetails.query = combineQueryParams(u1Details.query, u2Details.query);
} else {
combinedDetails = u2Details;
}
}
// Remove the fragment
combinedDetails.fragment = undefined;
// For relative URIs, add back the '..' since it was removed above
return (remoteUriTypes.indexOf(combinedDetails.reference) === -1 &&
combinedDetails.path.indexOf('../') === 0 ? '../' : '') + URI.serialize(combinedDetails);
}
function _getFullPath(p) {
return URI.serialize(p).split('#')[0] + '#';
}
function resolveUrl(baseId, id) {
id = normalizeId(id);
return URI.resolve(baseId, id);
}
doDeepLink (url: string) {
const parsedUri = URI.parse(url)
const query = parsedUri.query
if (!query || !query.includes('token=')) {
return
}
const splitArray = query.split('token=')
const nextString = splitArray[1]
const finalArray = nextString.split('&')
const token = finalArray[0]
this.props.urlReceived(token)
}
handleOpenURL = (event: Object) => {
function embed(uri, node, whitelist = '', debug = () => {}) {
if ((uri.scheme === 'http' || uri.scheme === 'https') && mm.some(uri.host, whitelist.split(','))) {
const children = [{ ...node }];
node.type = 'embed';
node.children = children;
node.url = URI.serialize(uri);
if (node.value) {
delete node.value;
}
} else {
debug(`Whitelist forbids embedding of URL: ${URI.serialize(uri)}`);
}
}
function _getFullPath(p) {
return URI.serialize(p).split('#')[0] + '#';
}