SIGN IN SIGN UP
payloadcms / payload UNCLAIMED

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.

0 0 16 TypeScript

fix: handle absolute paths correctly with tempFileDir upload option (#14436)

### What?

This PR fixes `tempFileDir` configuration not respecting absolute paths
when `useTempFiles` is enabled for uploads.

### Why?

1. **Absolute paths ignored**: Setting `tempFileDir: '/tmp'` would still
create temp files under the working directory (e.g.,
`/Users/project/tmp/...`) instead of `/tmp/...`

2. **Path duplication**: The default `tempFileDir` could result in
duplicated working directory segments in the path

### How?
Uses `path.resolve()` to handle both cases:
- Absolute paths (e.g., `/tmp`) are returned as-is
- Relative paths (e.g., `tmp`) are resolved against `process.cwd()`

Fixes #12910

---------

Co-authored-by: Jessica Chowdhury <jessica@trbl.design>
S
sanbrien committed
5ca9bd464fa4303edc387cb6745fac1f74e9d619
Parent: fa1cd62
Committed by GitHub <noreply@github.com> on 2/5/2026, 5:08:36 PM