From 247e5af5c755d3bcf5646deed6332c14c8dbc449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=81adniak?= Date: Fri, 14 Feb 2025 12:31:51 +0100 Subject: [PATCH] fix: exclude stackHeaders from entry data assignment Previously, if an entry contained stackHeaders, it would overwrite the existing stack headers. If tokens were updated in the meantime, this could result in an authorization error. --- lib/stack/contentType/entry/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/stack/contentType/entry/index.js b/lib/stack/contentType/entry/index.js index 6bcef110..d9ddded5 100644 --- a/lib/stack/contentType/entry/index.js +++ b/lib/stack/contentType/entry/index.js @@ -29,7 +29,8 @@ export function Entry (http, data) { if (this.apiVersion && !this.stackHeaders.api_version) { this.stackHeaders.api_version = this.apiVersion; } - Object.assign(this, cloneDeep(data.entry)) + const { stackHeaders, ...entryData } = data.entry; + Object.assign(this, cloneDeep(entryData)); this.urlPath = `/content_types/${this.content_type_uid}/entries/${this.uid}` /**