-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IgnoreInlineComment doesn't stop it adding `'s #360
Comments
I spent some time trying to make test cases to understand this issue better. This was written with the help of Claude.ai, but I was able to reproduce it with minimal code. Here's a bug report fresh out of the AI: Backticks incorrectly added around URLs containing '#' when using ini.Empty()DescriptionWhen using Reproduction Stepspackage main
import (
"fmt"
"gopkg.in/ini.v1"
)
func main() {
// Case 1: Using ini.Empty() (produces backticks)
cfg1 := ini.Empty()
section1, _ := cfg1.NewSection("test-section")
section1.Key("sso_start_url").SetValue("https://example.com/start#/")
// Case 2: Loading from source (works correctly)
sourceData := `[test-section]
sso_start_url = https://example.com/start#/`
cfg2, _ := ini.LoadSources(ini.LoadOptions{}, []byte(sourceData))
} Expected BehaviorThe URL should be written to the file without surrounding backticks: [test-section]
sso_start_url = https://example.com/start#/ Actual BehaviorThe URL is written with surrounding backticks: [test-section]
sso_start_url = `https://example.com/start#/` Test Cases ResultsWe've tested various scenarios:
[test-section]
sso_start_url = https://example.com/start#/
[test-section]
sso_start_url = `https://example.com/start#/`
[test-section]
sso_start_url = `https://example.com/start#/`
[test-section]
url1 = `https://example.com/start#/` # With # (fails)
url2 = http://example.com/start # Without # (works)
url3 = https://example.com/start?param=value # With ? (works) This suggests the issue is specifically related to the '#' character when using Environment
Additional Notes
ImpactThis causes issues when generating AWS configuration files, as the backticks make the configuration invalid for AWS tools. The URLs need to be written without backticks to be valid. |
Also the tests I ran were:
|
Version
1.67.0
Describe the bug
I have some code that parses the output of an AWS command. I use:
output is something like:
Later when setting up certain profiles I do:
When I save the .aws/config file however, I always get:
It will always wrap the output in
because of the # in the url. No matter what I do, """ quoting, single quotes, double quotes, anything, it still wraps that entire value in
. It's as if this code from go-ini is ignored:I'd appreciate any ideas or help you could suggest, I cannot make this stop wrapping it in `. I did find a related bug, #282, but it seemed like the solution maybe worked for @5nafu.
To reproduce
.
Expected behavior
No `'s in the output.
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: