[PR #1936] [MERGED] Fix: prevent custom headers from being cleared on save #36292

Closed
opened 2026-06-18 21:33:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/pangolin/pull/1936
Author: @PavanendraBaahubali
Created: 11/28/2025
Status: Merged
Merged: 11/29/2025
Merged by: @oschwartz10612

Base: mainHead: Pavan/fix-custom-header-reset


📝 Commits (2)

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 server/routers/resource/updateResource.ts (+1 -1)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

This PR fixes an issue where custom headers were being cleared when saving resource settings.
The values entered in the “Custom Headers” field were not persisted after editing authentication, general, or rules tabs.

Fix

  • Ensures custom header values are retained and correctly saved.
  • Prevents accidental loss of header data when updating resource settings.

The issue was that when saving settings from other tabs (General, Rules, Authentication), the request only included that tab’s data and didn’t include headers.

Previously we had:

let headers = null;
if (updateData.headers) {
  headers = JSON.stringify(updateData.headers);
}

So when updateData.headers was missing, headers stayed null and the DB overwrote existing custom headers with null.

I changed it to:

let headers = resource.headers;
if (updateData.headers) {
  headers = JSON.stringify(updateData.headers);
}

Now, if a request doesn’t include headers (e.g. saving General/Rules/Authentication only), we keep the existing resource.headers and no longer clear the custom headers.

Related Issue

Fixes #1885

Notes

Tested locally to confirm:

  • Custom headers persist after save
  • No clearing/resetting across tabs (authentication, general, rules)

How to test?

read this issue #1885


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/pangolin/pull/1936 **Author:** [@PavanendraBaahubali](https://github.com/PavanendraBaahubali) **Created:** 11/28/2025 **Status:** ✅ Merged **Merged:** 11/29/2025 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `main` ← **Head:** `Pavan/fix-custom-header-reset` --- ### 📝 Commits (2) - [`18070a3`](https://github.com/fosrl/pangolin/commit/18070a37a88610a18fcaa1657bff7381b167546d) fix: keep custom header values when editing resource - [`ff0b30f`](https://github.com/fosrl/pangolin/commit/ff0b30fc2e431357d1c629380b795821ef953e39) Merge branch 'main' of https://github.com/fosrl/pangolin into fix-custom-header-reset ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `server/routers/resource/updateResource.ts` (+1 -1) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description This PR fixes an issue where **custom headers were being cleared when saving resource settings**. The values entered in the “Custom Headers” field were not persisted after editing authentication, general, or rules tabs. ### **Fix** * Ensures custom header values are retained and correctly saved. * Prevents accidental loss of header data when updating resource settings. --- The issue was that when saving settings from other tabs (General, Rules, Authentication), the request only included that tab’s data and **didn’t include `headers`**. Previously we had: ```ts let headers = null; if (updateData.headers) { headers = JSON.stringify(updateData.headers); } ``` So when `updateData.headers` was missing, `headers` stayed `null` and the DB overwrote existing custom headers with `null`. I changed it to: ```ts let headers = resource.headers; if (updateData.headers) { headers = JSON.stringify(updateData.headers); } ``` Now, if a request doesn’t include `headers` (e.g. saving General/Rules/Authentication only), we keep the existing `resource.headers` and no longer clear the custom headers. ### **Related Issue** Fixes **#1885** ### **Notes** Tested locally to confirm: * Custom headers persist after save * No clearing/resetting across tabs (authentication, general, rules) ## How to test? read this issue **#1885** --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-18 21:33:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#36292