Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Email option to embed images as base64 instead of link#32061

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lunny merged 17 commits intogo-gitea:mainfromsommerf-lf:feature_B64_EMBED_IMAGES
Mar 5, 2025

Conversation

@sommerf-lf
Copy link
Contributor

@sommerf-lfsommerf-lf commentedSep 17, 2024
edited
Loading

ref:#15081
ref:#14037

Documentation:https://gitea.com/gitea/docs/pulls/69

Example

Content:
image
Result in Email:
image
Result with source code:
(first image is external image, 2nd is now embedded)
image

Beat2er reacted with heart emoji
@GiteaBotGiteaBot added the lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelSep 17, 2024
@github-actionsgithub-actionsbot added modifies/goPull requests that update Go code docs-update-neededThe document needs to be updated synchronously labelsSep 17, 2024
@sommerf-lfsommerf-lfforce-pushed thefeature_B64_EMBED_IMAGES branch 2 times, most recently from6bfebf7 to17439b9CompareSeptember 18, 2024 09:16
@sommerf-lf
Copy link
ContributorAuthor

sommerf-lf commentedSep 18, 2024
edited
Loading

Please have a look at this and let me know if I did some structural things wrong, as I have zero experience with Go but came across the mentioned issues myself and tried to add the optional setting to fix them.

@sommerf-lfsommerf-lfforce-pushed thefeature_B64_EMBED_IMAGES branch 2 times, most recently fromcc35853 to37428d3CompareSeptember 18, 2024 15:02
@sommerf-lfsommerf-lf marked this pull request as ready for reviewSeptember 18, 2024 15:17
@lunny
Copy link
Member

Could you have some tests?

@sommerf-lf
Copy link
ContributorAuthor

Could you have some tests?

I'll have a look. But I'm not quite sure as to what the focus of these test should be, as outgoing emails aren't tested anywhere. I could simply test my own additions whithout any actual email integration (the parsing of the html and replacement of the img tags and whether other image tags stay the same). Sounds fine?

@lunny
Copy link
Member

Could you have some tests?

I'll have a look. But I'm not quite sure as to what the focus of these test should be, as outgoing emails aren't tested anywhere. I could simply test my own additions whithout any actual email integration (the parsing of the html and replacement of the img tags and whether other image tags stay the same). Sounds fine?

Yes. Thank you.

@sommerf-lf
Copy link
ContributorAuthor

I added test to this. however I can't integrate them into services/mailer/mail_test.go because I need the testing environment which would form an import cycle. Now I exported the MailCommentContext and my newly added functions. Let me know if there is a way around this, but I see this as nothing big as these functions are not context specific. I'll squash the commits after you reviewed it

@sommerf-lfsommerf-lfforce-pushed thefeature_B64_EMBED_IMAGES branch 2 times, most recently from763b655 to6814a96CompareSeptember 20, 2024 21:51
@sommerf-lf
Copy link
ContributorAuthor

Still fails because I didn't account for using minio. Will rework...

@sommerf-lfsommerf-lf changed the titleEmail option to embed images as base64 instead of link[WIP] Email option to embed images as base64 instead of linkSep 21, 2024
@sommerf-lfsommerf-lf changed the title[WIP] Email option to embed images as base64 instead of linkEmail option to embed images as base64 instead of linkSep 22, 2024
@GiteaBotGiteaBot added lgtm/need 1This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelsSep 22, 2024
@wxiaoguang
Copy link
Contributor

Will do some refactoring first before continuing this. Thank you for your patience.

@wxiaoguangwxiaoguangforce-pushed thefeature_B64_EMBED_IMAGES branch 2 times, most recently from7cd0f0e tof3d6e2dCompareMarch 3, 2025 04:17
@wxiaoguangwxiaoguangforce-pushed thefeature_B64_EMBED_IMAGES branch fromf3d6e2d to599b78dCompareMarch 3, 2025 04:21
@GiteaBotGiteaBot added lgtm/doneThis PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1This PR needs approval from one additional maintainer to be merged. labelsMar 5, 2025
@wxiaoguangwxiaoguang marked this pull request as ready for reviewMarch 5, 2025 02:18
@wxiaoguangwxiaoguang added the type/featureCompletely new functionality. Can only be merged if feature freeze is not active. labelMar 5, 2025
@wxiaoguang
Copy link
Contributor

Made some changes:

  • Only keep one "EMBED_ATTACHMENT_IMAGES" config option, the size limit is hard-coded to 9MB. I think this limit is good enough to most users, and avoid bloating Gitea's config system too much.
    • If there are special requests, there is always a chance to add the "limit" config option back.
  • Instead of "guessing" the "attachments" path, use a strict parser to parse Gitea's route path
Beat2er reacted with thumbs up emojisommerf-lf reacted with heart emoji

@wxiaoguangwxiaoguang added the reviewed/wait-mergeThis pull request is part of the merge queue. It will be merged soon. labelMar 5, 2025
@lunnylunnyenabled auto-merge (squash)March 5, 2025 16:05
@lunnylunny merged commit7cdde20 intogo-gitea:mainMar 5, 2025
26 checks passed
@GiteaBotGiteaBot removed the reviewed/wait-mergeThis pull request is part of the merge queue. It will be merged soon. labelMar 5, 2025
zjjhot added a commit to zjjhot/gitea that referenced this pull requestMar 6, 2025
* giteaofficial/main:  [skip ci] Updated translations via Crowdin  Refactor: move part of updating protected branch logic to service layer (go-gitea#33742)  Update changelog for v1.23.5 (go-gitea#33797)  Email option to embed images as base64 instead of link (go-gitea#32061)  Update TypeScript types (go-gitea#33799)  Disable vet=off again (go-gitea#33794)
@go-giteago-gitea locked asresolvedand limited conversation to collaboratorsJun 3, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@yp05327yp05327yp05327 left review comments

@lunnylunnylunny approved these changes

@wxiaoguangwxiaoguangwxiaoguang approved these changes

+2 more reviewers

@dovydaszdovydaszdovydasz left review comments

@hiifonghiifonghiifong left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

@wxiaoguangwxiaoguang

Labels

docs-update-neededThe document needs to be updated synchronouslylgtm/doneThis PR has enough approvals to get merged. There are no important open reservations anymore.modifies/goPull requests that update Go codetype/featureCompletely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Milestone

1.24.0

Development

Successfully merging this pull request may close these issues.

9 participants

@sommerf-lf@lunny@yp05327@wxiaoguang@a1012112796@KazzmanK@dovydasz@hiifong@GiteaBot

[8]ページ先頭

©2009-2025 Movatter.jp