This is an automated email from the ASF dual-hosted git repository.
Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 84921f4ffc fix: config import returns 500 when zip size limits are
exceeded (#6451)
84921f4ffc is described below
commit 84921f4ffc3284eb48b8bdd31e752fdbc5a8e927
Author: hengyuss <[email protected]>
AuthorDate: Mon Jul 27 21:45:39 2026 +0800
fix: config import returns 500 when zip size limits are exceeded (#6451)
---
.../shenyu/admin/service/impl/ConfigsServiceImpl.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ConfigsServiceImpl.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ConfigsServiceImpl.java
index 5e4e65c592..2a10c3ce31 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ConfigsServiceImpl.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ConfigsServiceImpl.java
@@ -65,6 +65,7 @@ import org.apache.shenyu.common.utils.ListUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.util.Comparator;
@@ -361,7 +362,12 @@ public class ConfigsServiceImpl implements ConfigsService {
@Override
public ShenyuAdminResult configsImport(final byte[] source) {
- ZipUtil.UnZipResult unZipResult = ZipUtil.unzip(source, maxEntrySize,
maxTotalSize, maxEntryCount);
+ ZipUtil.UnZipResult unZipResult;
+ try {
+ unZipResult = ZipUtil.unzip(source, maxEntrySize, maxTotalSize,
maxEntryCount);
+ } catch (IllegalArgumentException e) {
+ return ShenyuAdminResult.error(HttpStatus.BAD_REQUEST.value(),
"Import failed: " + e.getMessage());
+ }
List<ZipUtil.ZipItem> zipItemList = unZipResult.getZipItemList();
if (CollectionUtils.isEmpty(zipItemList)) {
LOG.info("import file is empty");
@@ -406,7 +412,12 @@ public class ConfigsServiceImpl implements ConfigsService {
@Override
public ShenyuAdminResult configsImport(final String namespace, final
byte[] source) {
- ZipUtil.UnZipResult unZipResult = ZipUtil.unzip(source, maxEntrySize,
maxTotalSize, maxEntryCount);
+ ZipUtil.UnZipResult unZipResult;
+ try {
+ unZipResult = ZipUtil.unzip(source, maxEntrySize, maxTotalSize,
maxEntryCount);
+ } catch (IllegalArgumentException e) {
+ return ShenyuAdminResult.error(HttpStatus.BAD_REQUEST.value(),
"Import failed: " + e.getMessage());
+ }
List<ZipUtil.ZipItem> zipItemList = unZipResult.getZipItemList();
if (CollectionUtils.isEmpty(zipItemList)) {
LOG.info("import file is empty");