Skip to content

Conversation

ggqshr
Copy link
Contributor

@ggqshr ggqshr commented Oct 11, 2025

The new version of react-markdown cannot display images in the embed format. This issue can be fixed by following the method provided in the corresponding repository. Related issue: remarkjs/react-markdown#774 (comment).

@ggqshr ggqshr requested a review from a team as a code owner October 11, 2025 06:07
@eternal-flame-AD
Copy link
Member

Hi, thanks for the contribution.

The security model of markdowns in gotify is it should at least not XSS. This seems to me will allow javascript: URLs to be rendered

It seems like the discussion you quoted says you should use defaultUrlTransform by default and explicitly handle other known good cases if needed.

@ggqshr
Copy link
Contributor Author

ggqshr commented Oct 11, 2025

Understood, this indeed poses some security concerns. So, if we specially handle embedded image URLs and use defaultUrlTransform for non-image URLs, would this approach work?

Related PR: mlflow/mlflow#16761 (comment)

@eternal-flame-AD
Copy link
Member

Nice find, that should do it. I would match a semicolon after that as well just in case.

@ggqshr
Copy link
Contributor Author

ggqshr commented Oct 11, 2025

Done, and I also agree to include the semicolon in the match.

Copy link

codecov bot commented Oct 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.76%. Comparing base (9703021) to head (5244fa1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #857   +/-   ##
=======================================
  Coverage   78.76%   78.76%           
=======================================
  Files          56       56           
  Lines        2670     2670           
=======================================
  Hits         2103     2103           
  Misses        476      476           
  Partials       91       91           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@eternal-flame-AD eternal-flame-AD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Works for me as well.

CC: @MnM001 I think this should help your use case as well. You can use the command line to base64 encode the image straight in the message.

@eternal-flame-AD eternal-flame-AD linked an issue Oct 11, 2025 that may be closed by this pull request
6 tasks
// Copy from mlflow/server/js/src/shared/web-shared/genai-markdown-renderer/GenAIMarkdownRenderer.tsx
// Related PR: https://github.com/mlflow/mlflow/pull/16761
const urlTransform: UrlTransform = (value) => {
if (value.startsWith('data:image/png;') || value.startsWith('data:image/jpeg;')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the gotify/android we support a few more formats, maybe we could add image/gif here too? This seems like a commonly used format. For the rest we can wait until someone reports an issue.

@ggqshr
Copy link
Contributor Author

ggqshr commented Oct 13, 2025

Good point! I've added support for GIFs — that seems like a sensible addition. We can wait for further reports before adding more formats.

@eternal-flame-AD eternal-flame-AD merged commit 9879280 into gotify:master Oct 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Blue Iris - send alert to Gotify with Image and URL links

3 participants