Skip to content

Commit b995911

Browse files
committed
fix cover config failed when import config
1 parent 6dcc407 commit b995911

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Apollo 1.10.0
1212
* [Make Access Key Timestamp check configurable](https://github.com/ctripcorp/apollo/pull/3908)
1313
* [remove ctrip profile](https://github.com/ctripcorp/apollo/pull/3920)
1414
* [Remove spring dependencies from internal code](https://github.com/apolloconfig/apollo/pull/3937)
15-
* [Support export/import configs](https://github.com/apolloconfig/apollo/pull/3947)
15+
* [Support export/import configs by apollo env](https://github.com/apolloconfig/apollo/pull/3947)
1616

1717

1818
------------------

apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ConfigsImportController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void importConfigByZipWithIgnoreConflictNamespace(@RequestParam(value = "
9898

9999
byte[] bytes = file.getBytes();
100100
try (ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(bytes))) {
101-
configsImportService.importDataFromZipFile(importEnvs, zipInputStream, false);
101+
configsImportService.importDataFromZipFile(importEnvs, zipInputStream, true);
102102
}
103103
}
104104
}

apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ private void importItems(String appId, Env env, String clusterName, String names
384384
newItem.setDataChangeLastModifiedTime(new Date());
385385

386386
try {
387-
itemService.loadItem(env, appId, clusterName, namespaceName, key);
387+
ItemDTO oldItem = itemService.loadItem(env, appId, clusterName, namespaceName, key);
388+
newItem.setId(oldItem.getId());
388389
//existed
389390
itemService.updateItem(appId, env, clusterName, namespaceName, newItem);
390391
} catch (Exception e) {

0 commit comments

Comments
 (0)