Skip to content

Commit fbad39a

Browse files
authored
fix: safely access cookie header for uploads (#6373)
## Description Issue with editing and changing the crop or focal point of an image `fix`: adds optional chaining to safely access cookie header when fetching image v2 PR [here](#6367) - [x] I have read and understand the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] Existing test suite passes locally with my changes
1 parent e8d1d36 commit fbad39a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/payload/src/uploads/getExternalFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const getExternalFile = async ({ data, req, uploadConfig }: Args): Promis
2020

2121
const headers = uploadConfig.externalFileHeaderFilter
2222
? uploadConfig.externalFileHeaderFilter(Object.fromEntries(new Headers(req.headers)))
23-
: { cookie: req.headers.get('cookie') }
23+
: { cookie: req.headers?.get('cookie') }
2424

2525
const res = await fetch(fileURL, {
2626
credentials: 'include',

0 commit comments

Comments
 (0)