diff --git a/x-pack/legacy/plugins/epm/server/registry/index.test.ts b/x-pack/legacy/plugins/epm/server/registry/index.test.ts index 2b653d556ddd96..a65b6ecf4a8342 100644 --- a/x-pack/legacy/plugins/epm/server/registry/index.test.ts +++ b/x-pack/legacy/plugins/epm/server/registry/index.test.ts @@ -30,6 +30,17 @@ const testPaths = [ type: 'visualization', }, }, + { + path: 'coredns-1.0.1/dataset/stats/fields/coredns.stats.yml', + assetParts: { + dataset: 'stats', + file: 'coredns.stats.yml', + path: 'coredns-1.0.1/dataset/stats/fields/coredns.stats.yml', + pkgkey: 'coredns-1.0.1', + service: '', + type: 'fields', + }, + }, ]; test('testPathParts', () => { diff --git a/x-pack/legacy/plugins/epm/server/registry/index.ts b/x-pack/legacy/plugins/epm/server/registry/index.ts index f612a61ec8ec8e..1953817a404d47 100644 --- a/x-pack/legacy/plugins/epm/server/registry/index.ts +++ b/x-pack/legacy/plugins/epm/server/registry/index.ts @@ -86,6 +86,13 @@ export function pathParts(path: string): AssetParts { [pkgkey, service, type, file] = path.replace(`dataset/${dataset}/`, '').split('/'); } + // This is to cover for the fields.yml files inside the "fields" directory + if (file === undefined && type.endsWith('.yml')) { + file = type; + type = 'fields'; + service = ''; + } + return { pkgkey, service,