Skip to content

Commit

Permalink
refactor: 💡 rename whitelist -> allow-list in data plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jul 15, 2020
1 parent 6b506ba commit e3244a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/plugins/data/common/field_formats/converters/url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ describe('UrlFormat', () => {
});
});

describe('whitelist', () => {
test('should assume a relative url if the value is not in the whitelist without a base path', () => {
describe('allow-list', () => {
test('should assume a relative url if the value is not in the allow-list without a base path', () => {
const parsedUrl = {
origin: 'http://kibana',
basePath: '',
Expand All @@ -193,7 +193,7 @@ describe('UrlFormat', () => {
);
});

test('should assume a relative url if the value is not in the whitelist with a basepath', () => {
test('should assume a relative url if the value is not in the allow-list with a basepath', () => {
const parsedUrl = {
origin: 'http://kibana',
basePath: '/xyz',
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/data/common/field_formats/converters/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export class UrlFormat extends FieldFormat {

return this.generateImgHtml(url, imageLabel);
default:
const inWhitelist = allowedUrlSchemes.some((scheme) => url.indexOf(scheme) === 0);
if (!inWhitelist && !parsedUrl) {
const allowed = allowedUrlSchemes.some((scheme) => url.indexOf(scheme) === 0);
if (!allowed && !parsedUrl) {
return url;
}

Expand All @@ -178,7 +178,7 @@ export class UrlFormat extends FieldFormat {
* UNSUPPORTED
* - app/kibana
*/
if (!inWhitelist) {
if (!allowed) {
// Handles urls like: `#/discover`
if (url[0] === '#') {
prefix = `${origin}${pathname}`;
Expand Down

0 comments on commit e3244a9

Please sign in to comment.