Skip to content

docs: use crypto.randomBytes in diskStorage README example#1436

Open
Hashim1999164 wants to merge 1 commit into
expressjs:mainfrom
Hashim1999164:fix/readme-diskstorage-crypto-random
Open

docs: use crypto.randomBytes in diskStorage README example#1436
Hashim1999164 wants to merge 1 commit into
expressjs:mainfrom
Hashim1999164:fix/readme-diskstorage-crypto-random

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • Update the diskStorage custom filename example to use crypto.randomBytes instead of Math.random().
  • Align the README example with multer's default secure filename generator in storage/disk.js.

Fixes #1386

Test plan

  • Confirm the README DiskStorage example renders correctly
  • Confirm the example matches the callback style used by crypto.randomBytes in storage/disk.js

Replace Math.random() in the custom filename example with crypto.randomBytes,
matching multer's secure default filename generator.

Fixes expressjs#1386
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.

Security: README diskStorage example uses Math.random() for filenames instead of crypto-safe random

1 participant