Skip to content

Commit

Permalink
fix: trim db urls and remove special characters during backup restore (
Browse files Browse the repository at this point in the history
…appsmithorg#36201)

fixes: appsmithorg#36176 

<!-- This is an auto-generated comment: Cypress test results  -->
> [!WARNING]
> Tests have not run on the HEAD
dd01ffd yet
> <hr>Fri, 13 Sep 2024 10:38:44 UTC
<!-- end of auto-generated comment: Cypress test results  -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved handling of database URLs by removing leading and trailing
whitespace, enhancing robustness and preventing potential issues.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
pratapaprasanna authored and Shivam-z committed Sep 26, 2024
1 parent 4d7c08f commit aec7d03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deploy/docker/fs/opt/appsmith/utils/bin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function getDburl() {
let env_array = fs.readFileSync(Constants.ENV_PATH, 'utf8').toString().split("\n");
for (let i in env_array) {
if (env_array[i].startsWith("APPSMITH_MONGODB_URI") || env_array[i].startsWith("APPSMITH_DB_URL")) {
dbUrl = env_array[i].toString().split("=")[1];
dbUrl = env_array[i].toString().split("=")[1].trim();
break; // Break early when the desired line is found
}
}
Expand All @@ -48,7 +48,7 @@ function getDburl() {
let dbEnvUrl = process.env.APPSMITH_DB_URL || process.env.APPSMITH_MONGO_DB_URI;
// Make sure dbEnvUrl takes precedence over dbUrl
if (dbEnvUrl && dbEnvUrl !== "undefined") {
dbUrl = dbEnvUrl;
dbUrl = dbEnvUrl.trim();
}
return dbUrl;
}
Expand Down

0 comments on commit aec7d03

Please sign in to comment.