fix: app creation dupped names limit (#3130)

* fix: app creation dupped names limit

* fix: app dupped names
This commit is contained in:
Daniel Salazar
2026-05-19 12:18:59 -07:00
committed by GitHub
parent 0e990da961
commit 58fc122f0d
2 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -19199,7 +19199,7 @@
},
"src/puter-js": {
"name": "@heyputer/puter.js",
"version": "2.3.2",
"version": "2.3.4",
"license": "Apache-2.0",
"dependencies": {
"@heyputer/kv.js": "^0.2.1",
+7 -4
View File
@@ -157,13 +157,16 @@ export class AppDriver extends PuterDriver {
if (await this.appStore.existsByName(fields.name)) {
if (options?.dedupe_name) {
let candidate;
let n = 1;
let i = 0;
do {
candidate = `${fields.name}-${++n}`;
if (n > 50)
const randString = Math.random().toString(36).slice(2, 6);
candidate = `${fields.name}-${randString}`;
if (i >= 3)
throw new HttpError(400, 'Failed to dedupe app name', {
legacyCode: 'bad_request',
legacyCode: 'app_name_already_in_use',
});
i++;
} while (await this.appStore.existsByName(candidate));
fields.name = candidate;
} else {