Skip to content
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

add quotation mark for String #22

Merged
merged 4 commits into from
Aug 21, 2023

Conversation

Rory-Z
Copy link
Contributor

@Rory-Z Rory-Z commented Sep 5, 2022

if the string element have forbidden characters or the string is a empty string, then add quotation mark for them
More info, please check https://go.dev/play/p/6blMUYTercu

@codecov
Copy link

codecov bot commented Sep 5, 2022

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (0131d4e) 96.69% compared to head (cf53a5d) 96.70%.
Report is 17 commits behind head on master.

❗ Current head cf53a5d differs from pull request most recent head 9fcad82. Consider uploading reports for the commit 9fcad82 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
+ Coverage   96.69%   96.70%   +0.01%     
==========================================
  Files           3        3              
  Lines         726      729       +3     
==========================================
+ Hits          702      705       +3     
  Misses         17       17              
  Partials        7        7              
Files Changed Coverage Δ
config.go 93.87% <100.00%> (+0.07%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Rory-Z
Copy link
Contributor Author

Rory-Z commented Jun 6, 2023

Hi, @gurkankaymak Could you please review this PR ?

@gurkankaymak
Copy link
Owner

Hi @Rory-Z, sorry for the late response,
The regex appears to me not very readable can you update it to be more explicit, since there are only a handful of forbidden characters,
For instance, using the regex [$"{}[]:=,`^?!@*&\()] would make it clearer

@Rory-Z
Copy link
Contributor Author

Rory-Z commented Aug 14, 2023

Hi @Rory-Z, sorry for the late response, The regex appears to me not very readable can you update it to be more explicit, since there are only a handful of forbidden characters, For instance, using the regex [$"{}[]:=,`^?!@*&()] would make it clearer

Good idea, let me try it.

Signed-off-by: Rory Z <16801068+Rory-Z@users.noreply.github.com>
@Rory-Z
Copy link
Contributor Author

Rory-Z commented Aug 17, 2023

Hi @gurkankaymak Please review again

@Rory-Z
Copy link
Contributor Author

Rory-Z commented Aug 21, 2023

Thanks for your approved, can we merge this ?

@gurkankaymak gurkankaymak merged commit 49329f9 into gurkankaymak:master Aug 21, 2023
@sobotklp
Copy link

Are you sure this is the expected behavior for parsing quoted strings containing forbidden chars? For example, if my HOCON file looks like this:

endpoint = "127.0.0.1:6379" // Contains forbidden chars periods and colon

Then loading that via conf.GetString("endpoint") would have quotes in the resulting string. i.e.

endpoint := conf.GetString("endpoint")
fmt.Println(endpoint) // output includes the quotes i.e. "127.0.0.1:6379"

but I would have expected the quotes to be stripped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants