From 4e4d3effbd757bd679dd67d77aa6507140718130 Mon Sep 17 00:00:00 2001 From: wangpggg Date: Fri, 12 May 2023 11:00:28 +0800 Subject: [PATCH 1/3] modify the problem of two testcases failure Signed-off-by: wangpeng --- test/unittest/medialibrary_file_access_test.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unittest/medialibrary_file_access_test.cpp b/test/unittest/medialibrary_file_access_test.cpp index a9fe9cfc..a6b2a61b 100644 --- a/test/unittest/medialibrary_file_access_test.cpp +++ b/test/unittest/medialibrary_file_access_test.cpp @@ -2479,6 +2479,17 @@ HWTEST_F(FileAccessHelperTest, medialibrary_file_access_ScanFile_0004, testing:: static bool ReplaceBundleNameFromPath(std::string &path, const std::string &newName) { + Uri uri(path); + std::string scheme = uri.GetScheme(); + if (scheme == FILE_SCHEME_NAME) { + std::string curName = uri.GetAuthority(); + if (curName.empty()) { + return false; + } + path.replace(path.find(curName), curName.length(), newName); + return true; + } + std::string tPath = Uri(path).GetPath(); if (tPath.empty()) { GTEST_LOG_(INFO) << "Uri path error."; -- Gitee From 99a295b058224d9ac2ec6cd156e88010a21c2194 Mon Sep 17 00:00:00 2001 From: zhangxiaoliang25 Date: Thu, 18 May 2023 01:13:37 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E9=83=A8=E4=BB=B6=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangxiaoliang25 Change-Id: I6831f79e4ae799e8338013749517a1474dcd3523 --- bundle.json | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bundle.json b/bundle.json index 6ceec5fd..cfaa786c 100644 --- a/bundle.json +++ b/bundle.json @@ -24,11 +24,17 @@ "components": [ "ability_base", "ability_runtime", - "hiviewdfx", "ipc", - "relational_store", - "safwk", - "samgr" + "samgr", + "napi", + "file_api", + "bundle_framework", + "hiviewdfx_hilog_native", + "hitrace_native", + "access_token", + "c_utils", + "multimedia_image_framework", + "common_event_service" ] }, "build": { -- Gitee From 3eebf0992149cfb8dd72a4af80b1d216a32ab85a Mon Sep 17 00:00:00 2001 From: zhangxiaoliang25 Date: Mon, 15 May 2023 02:01:24 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AF=B9columns=E7=9A=84size=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=88=A4=E6=96=AD=EF=BC=8C=E9=98=B2=E6=AD=A2size?= =?UTF-8?q?=E8=BF=87=E5=A4=A7=E5=AF=BC=E8=87=B4=E7=B3=BB=E7=BB=9F=E9=87=8D?= =?UTF-8?q?=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangxiaoliang25 Change-Id: I706e723ae3328d7d625ed838d67bc90bec9812a6 --- .../inner_api/file_access/src/file_access_ext_proxy.cpp | 6 ++++++ .../inner_api/file_access/src/file_access_ext_stub.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/interfaces/inner_api/file_access/src/file_access_ext_proxy.cpp b/interfaces/inner_api/file_access/src/file_access_ext_proxy.cpp index ae5889a1..4c223537 100644 --- a/interfaces/inner_api/file_access/src/file_access_ext_proxy.cpp +++ b/interfaces/inner_api/file_access/src/file_access_ext_proxy.cpp @@ -16,6 +16,7 @@ #include "file_access_ext_proxy.h" #include "file_access_framework_errno.h" +#include "file_access_extension_info.h" #include "hilog_wrapper.h" #include "hitrace_meter.h" #include "ipc_types.h" @@ -646,6 +647,11 @@ int FileAccessExtProxy::Query(const Uri &uri, std::vector &columns, FinishTrace(HITRACE_TAG_FILEMANAGEMENT); return E_IPCS; } + if (count > FILE_RESULT_TYPE.size()) { + HILOG_ERROR(" The number of query operations exceeds %{public}d ", FILE_RESULT_TYPE.size()); + FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + return EINVAL; + } for (const auto &column : columns) { if (!data.WriteString(column)) { diff --git a/interfaces/inner_api/file_access/src/file_access_ext_stub.cpp b/interfaces/inner_api/file_access/src/file_access_ext_stub.cpp index 23620687..107d1567 100644 --- a/interfaces/inner_api/file_access/src/file_access_ext_stub.cpp +++ b/interfaces/inner_api/file_access/src/file_access_ext_stub.cpp @@ -567,6 +567,11 @@ ErrCode FileAccessExtStub::CmdQuery(MessageParcel &data, MessageParcel &reply) FinishTrace(HITRACE_TAG_FILEMANAGEMENT); return E_IPCS; } + if (count > FILE_RESULT_TYPE.size()) { + HILOG_ERROR(" The number of query operations exceeds %{public}d ", FILE_RESULT_TYPE.size()); + FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + return EINVAL; + } std::vector columns; for (int64_t i = 0; i < count; i++) { columns.push_back(data.ReadString()); -- Gitee