!917 db path length is less than or equal to 128 bytes

Merge pull request !917 from LeiiYB/master
This commit is contained in:
openharmony_ci 2023-10-23 12:42:25 +00:00 committed by Gitee
commit dda862c8be
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 4 additions and 5 deletions

View File

@ -126,8 +126,8 @@ int ParseDatabasePath(const napi_env &env, const napi_value &object, std::shared
}
auto [realPath, errCode] = RdbSqlUtils::GetDefaultDatabasePath(defaultDir, context->config.GetName(), customDir);
// customDir length is limited to 1024 bytes
CHECK_RETURN_SET(errCode == E_OK && realPath.length() <= 1024,
// customDir length is limited to 128 bytes
CHECK_RETURN_SET(errCode == E_OK && realPath.length() <= 128,
std::make_shared<ParamError>("config", "a StoreConfig."));
context->config.SetPath(std::move(realPath));

View File

@ -44,7 +44,7 @@ const STORE_CONFIG3 = {
const STORE_CONFIG4 = {
name: "RdbCustomDir4.db",
securityLevel: data_relationalStore.SecurityLevel.S1,
customDir: "custom".repeat(1000),
customDir: "custom".repeat(30), // customDir length exceeds 128 bytes
};
const asset1 = {
@ -415,7 +415,7 @@ describe('rdbStoreCustomTest', function () {
/**
* @tc.number testRdbStoreCustomDirTest00010
* @tc.name AbNormal test case of getRdbStore, if customDir length exceeds 1024 bytes
* @tc.name AbNormal test case of getRdbStore, if customDir length exceeds 128 bytes
* @tc.desc 1.Configure customDir
* 2.Execute getRdbStore
*/
@ -431,6 +431,5 @@ describe('rdbStoreCustomTest', function () {
}
console.info(TAG, "************* testRdbStoreCustomDirTest00010 end *************")
})
console.info(TAG, "*************Unit Test End*************");
})