[saas-e2e] adjust project name for new SpamSafe limits (#27875)

* [saas-e2e] adjust project name for new SpamSafe limits

* [saas-e2e] stay below 6 digits for spam safe project name

Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com>

---------

Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com>
GitOrigin-RevId: 77c039312c01b33aeb3b57661ec6ca5b88a0a36b
This commit is contained in:
Jakob Ackermann
2025-08-13 14:04:01 +02:00
committed by Copybot
parent 2e3ebabb88
commit 53ea8dc8f8
2 changed files with 13 additions and 1 deletions
+11
View File
@@ -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,
+2 -1
View File
@@ -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()
})