diff --git a/adapter/ohos/Uncompress.java b/adapter/ohos/Uncompress.java index b01c353a56c342d455115ff6086ec0e91e1d37ab..bd3d5d3e06845d780b7a48a8cbe593808be0cbce 100644 --- a/adapter/ohos/Uncompress.java +++ b/adapter/ohos/Uncompress.java @@ -1263,9 +1263,9 @@ public class Uncompress { } private static String getHapNameWithoutSuffix(String hapFileName) { - if (hapFileName == null || hapFileName.isEmpty()) { + if (hapFileName == null || hapFileName.isEmpty() || hapFileName.lastIndexOf(".") == -1) { return ""; } - return hapFileName.replace(HAP_SUFFIX, ""); + return hapFileName.substring(0, hapFileName.lastIndexOf(".")); } }