From 408857d01ea800700bdf337046d9323d5c4c3420 Mon Sep 17 00:00:00 2001 From: huaqingsimeng <1004904143@qq.com> Date: Mon, 29 May 2023 19:42:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9find=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=20=E6=94=B9=E4=B8=BAstart=5Fwith?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huaqingsimeng --- utils/src/b_error/b_excep_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/src/b_error/b_excep_utils.cpp b/utils/src/b_error/b_excep_utils.cpp index 5a6ad2f91..8abfd08e5 100644 --- a/utils/src/b_error/b_excep_utils.cpp +++ b/utils/src/b_error/b_excep_utils.cpp @@ -30,8 +30,8 @@ void BExcepUltils::VerifyPath(const string_view &path, bool isExtension) auto ret = canonicalize(path.data()); string absPath = ret.c_str(); if (isExtension && - absPath.find(string(BConstants::PATH_BUNDLE_BACKUP_HOME) - .append(BConstants::SA_BUNDLE_BACKUP_RESTORE)) == std::string::npos) { + !absPath.starts_with( + string(BConstants::PATH_BUNDLE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE))) { throw BError(BError::Codes::EXT_INVAL_ARG, "Invalid path, not in backup restore path"); } } catch (const rust::Error &e) { -- Gitee