Skip to content

Commit

Permalink
review IV
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierM committed Jul 22, 2019
1 parent 3cdb547 commit aec149c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/server/saved_objects/service/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,9 @@ export class SavedObjectsRepository {
}

const types = Array.isArray(type) ? type : [type];
const notAllowedTypes = types.filter(t => !this._allowedTypes.includes(t));
if (notAllowedTypes.length > 0) {
const allowedTypes = types.filter(t => this._allowedTypes.includes(t));
if (allowedTypes.length === 0) {
const notAllowedTypes = types.filter(t => !this._allowedTypes.includes(t));
SavedObjectsErrorHelpers.createUnsupportedTypeError(notAllowedTypes.join(', '));
}

Expand All @@ -431,7 +432,7 @@ export class SavedObjectsRepository {
}

const esOptions = {
index: this.getIndicesForTypes(types),
index: this.getIndicesForTypes(allowedTypes),
size: perPage,
from: perPage * (page - 1),
_source: includedFields(type, fields),
Expand Down

0 comments on commit aec149c

Please sign in to comment.