diff --git a/server-ce/test/helpers/project.ts b/server-ce/test/helpers/project.ts index bfa1cb1c83..c43e4825ac 100644 --- a/server-ce/test/helpers/project.ts +++ b/server-ce/test/helpers/project.ts @@ -132,6 +132,17 @@ export function shareProjectByEmailAndAcceptInviteViaDash( openProjectViaInviteNotification(projectName) } +export function getSpamSafeProjectName() { + while (true) { + // Move from hex/16 to base64/64 possible characters per char in string + const name = Buffer.from(uuid().replaceAll('-', ''), 'hex') + .toString('base64') + .slice(0, 10) + const nDigits = (name.match(/\d/g) || []).length + if (nDigits < 6) return name + } +} + export function shareProjectByEmailAndAcceptInviteViaEmail( projectName: string, email: string, diff --git a/server-ce/test/project-sharing.spec.ts b/server-ce/test/project-sharing.spec.ts index b806248398..0546919644 100644 --- a/server-ce/test/project-sharing.spec.ts +++ b/server-ce/test/project-sharing.spec.ts @@ -4,6 +4,7 @@ import { ensureUserExists, login } from './helpers/login' import { createProject, enableLinkSharing, + getSpamSafeProjectName, openProjectByName, openProjectViaLinkSharingAsAnon, openProjectViaLinkSharingAsUser, @@ -20,7 +21,7 @@ describe('Project Sharing', function () { let projectName: string beforeWithReRunOnTestRetry(function () { - projectName = `Project ${uuid()}` + projectName = getSpamSafeProjectName() setupTestProject() })