From 8da44732d2db389397273c44080275f28e00ebb4 Mon Sep 17 00:00:00 2001 From: cuiruibin Date: Sun, 7 Apr 2024 10:45:24 +0800 Subject: [PATCH] =?UTF-8?q?Uri=E8=A7=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=9B=9E=E9=80=80=20Signed-off-by:=20cuiruibin=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interfaces/common/src/sandbox_helper.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/interfaces/common/src/sandbox_helper.cpp b/interfaces/common/src/sandbox_helper.cpp index 312029e79..e15b6c1d7 100644 --- a/interfaces/common/src/sandbox_helper.cpp +++ b/interfaces/common/src/sandbox_helper.cpp @@ -48,9 +48,6 @@ namespace { const string LOCAL = "local"; const int ASSET_IN_BUCKET_NUM_MAX = 1000; const int ASSET_DIR_START_NUM = 16; - const int32_t DECODE_LEN = 2; - string deCodeInPutUri = ""; - string deCodeOutPutUri = ""; } struct MediaUriInfo { @@ -90,26 +87,23 @@ string SandboxHelper::Encode(const string &uri) string SandboxHelper::Decode(const string &uri) { - if (uri == deCodeInPutUri) { - return deCodeOutPutUri; - } std::ostringstream outPutStream; + const int32_t encodeLen = 2; size_t index = 0; while (index < uri.length()) { if (uri[index] == '%') { int hex = 0; - std::istringstream inputStream(uri.substr(index + 1, DECODE_LEN)); + std::istringstream inputStream(uri.substr(index + 1, encodeLen)); inputStream >> std::hex >> hex; outPutStream << static_cast(hex); - index += DECODE_LEN + 1; + index += encodeLen + 1; } else { outPutStream << uri[index]; index++; } } - deCodeInPutUri = uri; - deCodeOutPutUri = outPutStream.str(); - return deCodeOutPutUri; + + return outPutStream.str(); } static string GetLowerPath(string &lowerPathHead, const string &lowerPathTail, -- Gitee