[PR #457] [MERGED] do not HTML-escape prompt #15431

Closed
opened 2026-04-16 04:59:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/457
Author: @sqs
Created: 9/1/2023
Status: Merged
Merged: 9/2/2023
Merged by: @mxyng

Base: mainHead: dont-html-escape-prompt


📝 Commits (1)

  • 62d29b2 do not HTML-escape prompt

📊 Changes

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

View changed files

📝 server/images.go (+1 -1)
server/images_test.go (+23 -0)

📄 Description

The html/template package automatically HTML-escapes interpolated strings in templates. This behavior is undesirable because it causes prompts like <h1>hello to be escaped to &lt;h1&gt;hello before being passed to the LLM.

The included test case passes, but before the code change, it failed:

--- FAIL: TestModelPrompt
    images_test.go:21: got "a&lt;h1&gt;b", want "a<h1>b"

🔄 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/ollama/ollama/pull/457 **Author:** [@sqs](https://github.com/sqs) **Created:** 9/1/2023 **Status:** ✅ Merged **Merged:** 9/2/2023 **Merged by:** [@mxyng](https://github.com/mxyng) **Base:** `main` ← **Head:** `dont-html-escape-prompt` --- ### 📝 Commits (1) - [`62d29b2`](https://github.com/ollama/ollama/commit/62d29b2157d8fec5ec45de7a9fa70fc6fcf02408) do not HTML-escape prompt ### 📊 Changes **2 files changed** (+24 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `server/images.go` (+1 -1) ➕ `server/images_test.go` (+23 -0) </details> ### 📄 Description The `html/template` package automatically HTML-escapes interpolated strings in templates. This behavior is undesirable because it causes prompts like `<h1>hello` to be escaped to `&lt;h1&gt;hello` before being passed to the LLM. The included test case passes, but before the code change, it failed: ``` --- FAIL: TestModelPrompt images_test.go:21: got "a&lt;h1&gt;b", want "a<h1>b" ``` --- <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-04-16 04:59:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#15431