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

Inline image is not processed if file extension is .jpg #5160

Open
t-shehab opened this issue May 3, 2024 · 0 comments
Open

Inline image is not processed if file extension is .jpg #5160

t-shehab opened this issue May 3, 2024 · 0 comments

Comments

@t-shehab
Copy link

t-shehab commented May 3, 2024

Used Zammad Version

6.3

Environment

  • Installation method: any
  • Operating system (if you're unsure: cat /etc/os-release ): any
  • Database + version: any
  • Elasticsearch version: any
  • Browser + version: any

Actual behaviour

POST with the following payload:

    {
        "ticket_id": 1,
        "subject": "My article with inline image.",
        "body": "this is an inline image: <img src=\"data:image/jpg;base64,<my_base64_string_here>\">",
        "content_type": "text/html",
        "type": "note",
        "internal": "true"
    }

results in:

  body: "this is an inline image: <img src=\"data:image/jpg;base64,<my_base64_string_here>\">",

Expected behaviour

body: "this is an inline image: <img src=\"cid:1.a66af266-3a23-48ac-aa23-371a869ba56f@my_fqdn.example.com\">",

Steps to reproduce the behaviour

For reproduction steps, see above.

Steps to fix the behaviour:

/opt/zammad/lib/html_sanitizer/scrubber/inline_images.rb

18c18
<         if node['src'] && node['src'] =~ %r{^(data:image/(jpeg|png);base64,.+?)$}i
---
>         if node['src'] && node['src'] =~ %r{^(data:image/(jpg|jpeg|png);base64,.+?)$}i
32c32
<         matchdata = src.match %r{^(data:image/(jpeg|png);base64,.+?)$}i
---
>         matchdata = src.match %r{^(data:image/(jpg|jpeg|png);base64,.+?)$}i

Support Ticket

No response

I'm sure this is a bug and no feature request or a general question.

yes

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

No branches or pull requests

1 participant