diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationService.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationService.java index 020b34a6e7..a28473ea22 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationService.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ImportExportApplicationService.java @@ -723,10 +723,13 @@ public class ImportExportApplicationService { //Mapping ds name in id field ds.setId(datasourceMap.get(ds.getId())); ds.setOrganizationId(null); - ds.setPluginId(null); + if (ds.getPluginId() != null) { + ds.setPluginId(pluginMap.get(ds.getPluginId())); + } return ds.getId(); } else { - // This means we don't have regular datasource it can be simple REST_API + // This means we don't have regular datasource it can be simple REST_API and will also be used when + // importing the action to populate the data ds.setOrganizationId(organizationId); ds.setPluginId(pluginMap.get(ds.getPluginId())); return ""; diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java index 0da293aebf..ad52f36718 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java @@ -384,8 +384,9 @@ public class ImportExportApplicationServiceTests { assertThat(validAction.getOrganizationId()).isNull(); assertThat(validAction.getPolicies()).isNull(); assertThat(validAction.getId()).isNotNull(); - assertThat(validAction.getUnpublishedAction().getPageId()) - .isEqualTo(defaultPage.getUnpublishedPage().getName()); + ActionDTO unpublishedAction = validAction.getUnpublishedAction(); + assertThat(unpublishedAction.getPageId()).isEqualTo(defaultPage.getUnpublishedPage().getName()); + assertThat(unpublishedAction.getDatasource().getPluginId()).isEqualTo(installedPlugin.getPackageName()); assertThat(datasourceList).hasSize(1); Datasource datasource = datasourceList.get(0);