Skip to content

docs: clarify preservePath behavior - #1414

Merged
UlisesGascon merged 2 commits into
expressjs:mainfrom
vibhor-aggr:docs/clarify-preservepath-option
Aug 24, 2026
Merged

UlisesGascon merged 2 commits into
expressjs:mainfrom
vibhor-aggr:docs/clarify-preservepath-option

Conversation

@vibhor-aggr

Copy link
Copy Markdown
Contributor

Clarifies what preservePath: true does for uploaded file metadata.

The README currently says it keeps the full path instead of the base name, but it does not explain where that path appears or that it is client-supplied input. This adds wording that:

  • identifies file.originalname as the field affected by preservePath;
  • notes that Multer does not create directories or sanitize the path;
  • warns applications to normalize or validate file.originalname before using it in a custom filename or storage engine.

Refs #846.

Verification:

  • npm test (72 passing)
  • npm run lint with HOME pointed at the task workspace because the sandbox home is read-only
  • git diff --check HEAD~1..HEAD

@UlisesGascon UlisesGascon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vibhor-aggr! I just added a minor suggestion 👍

Comment thread README.md Outdated
@UlisesGascon UlisesGascon self-assigned this Aug 24, 2026
@UlisesGascon
UlisesGascon merged commit cd6e89c into expressjs:main Aug 24, 2026
22 checks passed
This was referenced Aug 24, 2026
YasharF added a commit to sahat/hackathon-starter that referenced this pull request Aug 28, 2026
config/morgan.js: colors moved out of the token and into the format string, where morgan doesn't touch them

Dependency Release Notes:

Multer v2.3.0
- Fix [CVE-2026-77078](https://www.cve.org/CVERecord?id=CVE-2026-77078) ([GHSA-wc9g-mqfw-jrwm](GHSA-wc9g-mqfw-jrwm))
- Fix [CVE-2026-77037](https://www.cve.org/CVERecord?id=CVE-2026-77037) ([GHSA-qfvm-cv95-jqjf](GHSA-qfvm-cv95-jqjf))
- Fix [CVE-2026-77063](https://www.cve.org/CVERecord?id=CVE-2026-77063) ([GHSA-qvfw-j98x-7q72](GHSA-qvfw-j98x-7q72))
- Fix [CVE-2026-82333](https://www.cve.org/CVERecord?id=CVE-2026-82333) ([GHSA-535w-7cp7-47q4](GHSA-535w-7cp7-47q4))
- Add `MulterError` codes `INVALID_FIELD_NAME` and `STREAM_DESTROYED`
- Add opt-in `limits.fieldArrayIndexLimit` to bound numeric array indexes in field names ([#1438](expressjs/multer#1438))
- Accept files whose size is exactly `limits.fileSize` ([#1407](expressjs/multer#1407))
- Preserve the caller's async context (`AsyncLocalStorage`) when calling `next()` ([#1124](expressjs/multer#1124))
- Decode WHATWG-escaped characters (`%0A`, `%0D`, `%22`) in `file.originalname` ([#1421](expressjs/multer#1421))
- Do not crash when `fileFilter` invokes its callback more than once ([#1427](expressjs/multer#1427))
- Use a fallback message for `MulterError` codes without a mapping ([#1448](expressjs/multer#1448))
- Docs: clarify `preservePath` and `parts`, use `crypto.randomBytes` in the `DiskStorage` example ([#1414](expressjs/multer#1414), [#1430](expressjs/multer#1430), [#1436](expressjs/multer#1436))
- Docs: add Indonesian, Japanese and Tamil translations and refresh all translations from the current README ([#1431](expressjs/multer#1431), [#1354](expressjs/multer#1354), [#1462](expressjs/multer#1462))
- Internal: run the test suite on Windows ([#1334](expressjs/multer#1334))

Morgan 1.12.0
- Security fix for [CVE-2026-15603](https://www.cve.org/CVERecord?id=CVE-2026-15603)([GHSA-jxfw-x594-9x9m](https://github.com/expressjs/morgan/security/advisories/GHSA-jxfw-x594-9x9m))
- Allow format functions to return objects for streams in `objectMode`
- Respect the `NO_COLOR` environment variable in the `dev` format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants