Skip to content

Conversation

zeripath
Copy link
Contributor

Unfortunately the fallback configuration code for [mailer] that were added in #18982 are incorrect. When you read a value from an ini section that key is added. This leads to a failure of the fallback mechanism. Further there is also a spelling mistake in the startTLS configuration.

This PR restructures the mailer code to first map the deprecated settings on to the new ones - and then use ini.MapTo to map those on to the struct with additional validation as necessary.

Ref #21744

Signed-off-by: Andrew Thornton art27@cantab.net

Unfortunately the fallback configuration code for [mailer] that were
added in go-gitea#18982 are incorrect. When you read a value from an ini
section that key is added. This leads to a failure of the fallback
mechanism. Further there is also a spelling mistake in the startTLS
configuration.

This PR restructures the mailer code to first map the deprecated
settings on to the new ones - and then use ini.MapTo to map those
on to the struct with additional validation as necessary.

Ref go-gitea#21744

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added type/bug outdated/backport/v1.18 This PR should be backported to Gitea 1.18 labels Nov 26, 2022
@zeripath zeripath added this to the 1.19.0 milestone Nov 26, 2022
Signed-off-by: Andrew Thornton <art27@cantab.net>
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Nov 26, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 27, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #21945 (a791a79) into main (5f38acd) will decrease coverage by 0.05%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##             main   #21945      +/-   ##
==========================================
- Coverage   48.19%   48.14%   -0.06%     
==========================================
  Files        1037     1037              
  Lines      141359   141353       -6     
==========================================
- Hits        68128    68051      -77     
- Misses      65098    65162      +64     
- Partials     8133     8140       +7     
Impacted Files Coverage Δ
cmd/hook.go 7.11% <0.00%> (ø)
modules/base/tool.go 92.75% <ø> (ø)
services/mailer/mailer.go 31.55% <0.00%> (ø)
modules/setting/mailer.go 33.33% <36.00%> (-5.96%) ⬇️
modules/setting/setting.go 48.93% <100.00%> (ø)
modules/queue/queue_bytefifo.go 47.29% <0.00%> (-5.78%) ⬇️
services/pull/update.go 46.15% <0.00%> (-4.28%) ⬇️
modules/notification/mail/mail.go 29.41% <0.00%> (-2.95%) ⬇️
services/pull/temp_repo.go 43.22% <0.00%> (-2.59%) ⬇️
modules/log/event.go 58.18% <0.00%> (-2.10%) ⬇️
... and 9 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@zeripath zeripath merged commit f6fd501 into go-gitea:main Nov 27, 2022
@zeripath zeripath deleted the correctly-fallback-mailer-configuration branch November 27, 2022 10:08
zeripath added a commit to zeripath/gitea that referenced this pull request Nov 27, 2022
Backport go-gitea#21945

Unfortunately the fallback configuration code for [mailer] that were
added in go-gitea#18982 are incorrect. When you read a value from an ini section
that key is added. This leads to a failure of the fallback mechanism.
Further there is also a spelling mistake in the startTLS configuration.

This PR restructures the mailer code to first map the deprecated
settings on to the new ones - and then use ini.MapTo to map those on to
the struct with additional validation as necessary.

Ref go-gitea#21744

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added the backport/done All backports for this PR have been created label Nov 27, 2022
zeripath added a commit that referenced this pull request Nov 27, 2022
Backport #21945

Unfortunately the fallback configuration code for [mailer] that were
added in #18982 are incorrect. When you read a value from an ini section
that key is added. This leads to a failure of the fallback mechanism.
Further there is also a spelling mistake in the startTLS configuration.

This PR restructures the mailer code to first map the deprecated
settings on to the new ones - and then use ini.MapTo to map those on to
the struct with additional validation as necessary.

Ref #21744

Signed-off-by: Andrew Thornton <art27@cantab.net>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Nov 29, 2022
* giteaofficial/main:
  Use random bytes to generate access token (go-gitea#21959)
  Replace fmt.Sprintf with hex.EncodeToString (go-gitea#21960)
  Implement FSFE REUSE for golang files (go-gitea#21840)
  Correct the fallbacks for mailer configuration (go-gitea#21945)
  [skip ci] Updated licenses and gitignores
  Fix typos (go-gitea#21947)
  Fix markdown anchor re-clicking (go-gitea#21931)
  Prevent NPE if trying to restore an already restored deleted branch (go-gitea#21940)
  add rel="me" to org.website link (go-gitea#21941)
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. outdated/backport/v1.18 This PR should be backported to Gitea 1.18 type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants