[PR #4656] [MERGED] Use text/template instead of html/template for config pre-processing #5019

Closed
opened 2026-05-05 14:53:12 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/4656
Author: @hansmi
Created: 2/4/2025
Status: Merged
Merged: 2/7/2025
Merged by: @fatedier

Base: devHead: template1


📝 Commits (1)

  • 8a0fd2a Use text/template instead of html/template for config pre-processing

📊 Changes

2 files changed (+24 additions, -1 deletions)

View changed files

📝 pkg/config/load.go (+1 -1)
📝 pkg/config/load_test.go (+23 -0)

📄 Description

Commit c95311d1 added support for multiple config formats in addition to pre-processing using Go's built-in templating system. The html/template package is equivalent to text/template, except that the former automatically escapes characters for inclusion in HTML.

Configurations aren't plain text, but they're also certainly no HTML. The difference between the packages is noticeable when using printf "%q" for quoting of strings. An example from the included unittest:

  • html/template: key = "with space"
  • text/template: key = "with space"

🔄 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/fatedier/frp/pull/4656 **Author:** [@hansmi](https://github.com/hansmi) **Created:** 2/4/2025 **Status:** ✅ Merged **Merged:** 2/7/2025 **Merged by:** [@fatedier](https://github.com/fatedier) **Base:** `dev` ← **Head:** `template1` --- ### 📝 Commits (1) - [`8a0fd2a`](https://github.com/fatedier/frp/commit/8a0fd2acd5c745f61f6eda6466652c665cdd6623) Use text/template instead of html/template for config pre-processing ### 📊 Changes **2 files changed** (+24 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `pkg/config/load.go` (+1 -1) 📝 `pkg/config/load_test.go` (+23 -0) </details> ### 📄 Description Commit c95311d1 added support for multiple config formats in addition to pre-processing using Go's built-in templating system. The `html/template` package is equivalent to `text/template`, except that the former automatically escapes characters for inclusion in HTML. Configurations aren't plain text, but they're also certainly no HTML. The difference between the packages is noticeable when using `printf "%q"` for quoting of strings. An example from the included unittest: * `html/template`: `key = &#34;with space&#34;` * `text/template`: `key = "with space"` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 14:53:12 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#5019
No description provided.