Skip to content

Commit

Permalink
fix the local cluster 404 Not Found error and import.test integration…
Browse files Browse the repository at this point in the history
… 500 error
  • Loading branch information
yujin-emma committed Feb 1, 2024
1 parent 27a2ba0 commit 43f3465
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/server/saved_objects/routes/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const registerImportRoute = (router: IRouter, config: SavedObjectConfig)
{
overwrite: schema.boolean({ defaultValue: false }),
createNewCopies: schema.boolean({ defaultValue: false }),
dataSourceId: schema.string({ defaultValue: '' }),
dataSourceId: schema.maybe(schema.string({ defaultValue: '' })),
},
{
validate: (object) => {
Expand All @@ -84,17 +84,17 @@ export const registerImportRoute = (router: IRouter, config: SavedObjectConfig)
}

// get datasource from saved object service
const dataSource = await context.core.savedObjects.client
const dataSource = dataSourceId ? await context.core.savedObjects.client

Check failure on line 87 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `⏎·······`
.get('data-source', dataSourceId)

Check failure on line 88 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `····`
.then((response) => {

Check failure on line 89 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `····`
const attributes: any = response?.attributes || {};

Check failure on line 90 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `····`
return {

Check failure on line 91 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `····`
id: response.id,

Check failure on line 92 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `····`
title: attributes.title,

Check failure on line 93 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `····`
};

Check failure on line 94 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Insert `····`
});
}) : '';

Check failure on line 95 in src/core/server/saved_objects/routes/import.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Replace `})` with `····})⏎·······`

const dataSourceTitle = dataSource.title;
const dataSourceTitle = dataSource ? dataSource.title : '';

let readStream: Readable;
try {
Expand Down

0 comments on commit 43f3465

Please sign in to comment.