diff --git a/interfaces/kits/js/src/mod_fs/properties/open.cpp b/interfaces/kits/js/src/mod_fs/properties/open.cpp index 0b2c44be2d37ddfa2d315601e9a6918cd741e64d..822e9eaf67f5101bec4e1a804a74c0e884bea7c6 100644 --- a/interfaces/kits/js/src/mod_fs/properties/open.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/open.cpp @@ -58,25 +58,6 @@ static tuple GetJsFlags(napi_env env, const NFuncArg &funcAr return { true, mode }; } -static string DealWithUriWithName(string str) -{ - static uint32_t MEET_COUNT = 6; - uint32_t count = 0; - uint32_t index; - for (index = 0; index < str.length(); index++) { - if (str[index] == '/') { - count++; - } - if (count == MEET_COUNT) { - break; - } - } - if (count == MEET_COUNT) { - str = str.substr(0, index); - } - return str; -} - static NVal InstantiateFile(napi_env env, int fd, string pathOrUri, bool isUri) { napi_value objFile = NClass::InstantiateClass(env, FileNExporter::className_, {}); @@ -127,7 +108,6 @@ static int OpenFileByDatashare(string path, unsigned int flags) HILOGE("Failed to connect to datashare"); return -E_PERMISSION; } - path = DealWithUriWithName(path); Uri uri(path); fd = dataShareHelper->OpenFile(uri, CommonFunc::GetModeFromFlags(flags)); return fd;