From ec0dcc93836009183c9e7de19020588a60e56b86 Mon Sep 17 00:00:00 2001 From: lanhaoyu Date: Fri, 12 Sep 2025 15:49:49 +0800 Subject: [PATCH] fix_mult_point_error_suffix Signed-off-by: lanhaoyu --- services/bundlemgr/src/bundle_mgr_host_impl.cpp | 4 ++++ .../bms_bundle_manager_test_three.cpp | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/services/bundlemgr/src/bundle_mgr_host_impl.cpp b/services/bundlemgr/src/bundle_mgr_host_impl.cpp index 3c5d106db9..31c9864256 100644 --- a/services/bundlemgr/src/bundle_mgr_host_impl.cpp +++ b/services/bundlemgr/src/bundle_mgr_host_impl.cpp @@ -6299,6 +6299,10 @@ ErrCode BundleMgrHostImpl::GetAbilityResourceInfo(const std::string &fileType, } RemoveSameAbilityResourceInfo(launcherAbilityResourceInfos); } else { + if (fileType.find('.') != fileType.rfind('.')) { + APP_LOGW("fileType format error"); + return ERR_APPEXECFWK_INPUT_WRONG_TYPE_FILE; + } Want want; want.SetAction(ACTION_VIEW_DATA); want.SetUri(FILE_URI + Constants::SCHEME_SEPARATOR + fileType); diff --git a/services/bundlemgr/test/unittest/bms_bundle_manager_test/bms_bundle_manager_test_three.cpp b/services/bundlemgr/test/unittest/bms_bundle_manager_test/bms_bundle_manager_test_three.cpp index 28ebf6c523..ccfc1bd441 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_manager_test/bms_bundle_manager_test_three.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_manager_test/bms_bundle_manager_test_three.cpp @@ -2194,6 +2194,21 @@ HWTEST_F(BmsBundleManagerTest3, GetAbilityResourceInfo_0004, Function | MediumTe EXPECT_EQ(testRet, ERR_OK); } +/** + * @tc.number: GetAbilityResourceInfo_0005 + * @tc.name: test GetAbilityResourceInfo + * @tc.desc: 1.test GetAbilityResourceInfo + 2.text fileType + */ +HWTEST_F(BmsBundleManagerTest3, GetAbilityResourceInfo_0005, Function | MediumTest | Level1) +{ + auto hostImpl = std::make_unique(); + std::string fileType = "...jpg"; + std::vector launcherAbilityResourceInfos; + auto testRet = hostImpl->GetAbilityResourceInfo(fileType, launcherAbilityResourceInfos); + EXPECT_EQ(testRet, ERR_APPEXECFWK_INPUT_WRONG_TYPE_FILE); +} + /** * @tc.number: GetSpecificResourceInfo_0001 * @tc.name: test GetSpecificResourceInfo -- Gitee