Skip to content

Commit

Permalink
Fix Runtime Download in Cloud (elastic#49538)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintandrewhall committed Oct 29, 2019
1 parent 78ccc24 commit f556687
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions x-pack/legacy/plugins/canvas/server/routes/shareables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
SHAREABLE_RUNTIME_FILE,
SHAREABLE_RUNTIME_NAME,
SHAREABLE_RUNTIME_SRC,
SHAREABLE_RUNTIME_OUTPUT,
} from '../../shareable_runtime/constants';

import { CoreSetup } from '../shim';
Expand All @@ -26,14 +25,13 @@ export function shareableWorkpads(route: CoreSetup['http']['route']) {
route({
method: 'GET',
path: API_ROUTE_SHAREABLE_RUNTIME,
options: {
files: {
relativeTo: SHAREABLE_RUNTIME_OUTPUT,
},
},

handler: {
file: {
path: SHAREABLE_RUNTIME_FILE,
// The option setting is not for typical use. We're using it here to avoid
// problems in Cloud environments. See elastic/kibana#47405.
confine: false,
},
},
});
Expand All @@ -42,14 +40,12 @@ export function shareableWorkpads(route: CoreSetup['http']['route']) {
route({
method: 'GET',
path: API_ROUTE_SHAREABLE_RUNTIME_DOWNLOAD,
options: {
files: {
relativeTo: SHAREABLE_RUNTIME_OUTPUT,
},
},

handler(_request, handler) {
// The option setting is not for typical use. We're using it here to avoid
// problems in Cloud environments. See elastic/kibana#47405.
// @ts-ignore No type for inert Hapi handler
const file = handler.file(SHAREABLE_RUNTIME_FILE);
const file = handler.file(SHAREABLE_RUNTIME_FILE, { confine: false });
file.type('application/octet-stream');
return file;
},
Expand Down

0 comments on commit f556687

Please sign in to comment.