Skip to content

Commit

Permalink
Cleanup (#71849)
Browse files Browse the repository at this point in the history
* chore: 🤖 update codeowners file

* refactor: 💡 rename whitelist -> allow-list in data plugin

* Update .github/CODEOWNERS

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
# Conflicts:
#	.github/CODEOWNERS
  • Loading branch information
streamich committed Jul 15, 2020
1 parent a009663 commit 79c8b87
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 79c8b87

Please sign in to comment.