Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Canvas Shareable Runtime Download in Cloud #49538

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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