Skip to content

fix: truncate creator profile fields by bytes#559

Open
pengyuayn wants to merge 1 commit into
accesslayerorg:mainfrom
pengyuayn:feature/truncate-to-bytes
Open

fix: truncate creator profile fields by bytes#559
pengyuayn wants to merge 1 commit into
accesslayerorg:mainfrom
pengyuayn:feature/truncate-to-bytes

Conversation

@pengyuayn

Copy link
Copy Markdown

Summary

  • Adds truncateToBytes(value, maxBytes) for UTF-8 byte-safe string truncation.
  • Applies byte-safe truncation before creator profile fields are persisted.
  • Extends tests for ASCII, empty strings, multi-byte character boundaries, and creator profile write normalization.

Closes #556

Testing

  • ./node_modules/.bin/jest src/utils/string-truncate.utils.test.ts src/modules/creator/creator-profile.service.test.ts --runInBand (18 tests passed)
  • ./node_modules/.bin/eslint src/utils/string-truncate.utils.ts src/utils/string-truncate.utils.test.ts src/modules/creator/creator-profile.service.ts src/modules/creator/creator-profile.service.test.ts
  • ./node_modules/.bin/prettier --check src/utils/string-truncate.utils.ts src/utils/string-truncate.utils.test.ts src/modules/creator/creator-profile.service.ts src/modules/creator/creator-profile.service.test.ts
  • ./node_modules/.bin/tsc -p tsconfig.json --noEmit currently fails on existing Prisma generated-client/model typing issues across unrelated modules after local install/generate, e.g. missing creatorProfile, user, webhook model properties on the Prisma client.

Notes

  • The repository pre-commit hook invokes pnpm install/status and is blocked locally by ignored build-script approvals for Prisma and other native dependencies. The targeted checks above were run directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add helper for safely truncating strings to a maximum byte length for database writes

1 participant