mattermost-community / mattermost-plugin-memes

Add culture to your Mattermost with memes 🔌

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only first text token is rendered

senritsu opened this issue · comments

With Mattermost Version 7.0.0 and the Memes plugin 1.4.0 only part of the text displays.

Using the example from the README: /meme everywhere "memes." "memes everywhere" results in:

image

Similarly the example from everywhere.yaml used as /meme geese. geese everywhere also displays just:

image

@senritsu thanks for opening this issue. However, I am unable to reproduce it using your example. Both strings are accepted and shown in the resulting meme. I also tried this on a v7.0.0 server and still don't see the issue.

Can you please confirm if it's still happening for you?

Unfortunately I cannot, I have recently changed company and no longer have access to the mattermost installation of my previous employer.

I can confirm the issue for Mattermost-Version: 7.1.2. I'm not able to check the plugin version but I can confirm the issue even with the example from /meme
grafik

Hi,

I confirm on 7.0.1, we have the issue and plugin 1.4.0

Any ideas?
Thanks

@Gusser93 and @floviolleau Thanks for your help in confirming. 👍

I did find a server where I can repro the issue even though it has the same meme build deployed as other servers I've looked at.
I'm trying now to isolate the repro steps.

After a bit of investigation I am unable to determine why only some servers are affected. Tested matching server version, and plugin version. Tested modifying several values regarding posts in the config to see if I can make the issue occur on a server.

The request shows the 2nd string appended
image
And in the response - I can see the & has been encodded
image
But these look exactly the same on a server where the issue does not occur.

Also noticed the Community server is affected by this issue.

Leaving in triage for dev input.

Hi,

What do you need as input?

commented

Still reproducible on 7.7.1. I see this error in the log:
error [2023-01-31 22:58:11.967 +01:00] http: URL query contains semicolon, which is no longer a supported separator; parts of the query may be stripped when parsed; see golang.org/issue/25192 caller="log/log.go:195" source=httpserver

I provide the following information with this hint

https://mattermost.gitlab.rlp.net/api/v4/image?url=https://mattermost.gitlab.rlp.net/plugins/memes/templates/everywhere.jpg?text=Test&text=Test does not work (which is the request used by the mattermost web app). This leads to the request https://mattermost.gitlab.rlp.net/plugins/memes/templates/everywhere.jpg?text=Test&text=Test which does not work. Maybe the problem is the imageproxy in mattermost, which URL-encodes the & but does not reverse the process when redirecting here?

https://mattermost.gitlab.rlp.net/api/v4/image?url=https://mattermost.gitlab.rlp.net/plugins/memes/templates/everywhere.jpg?text=Test&text=Test2 and
https://mattermost.gitlab.rlp.net/api/v4/image?url=https://community.mattermost.com/plugins/memes/templates/everywhere.jpg?text=Test&text=Test do work, when used in the mattermost web app. Please note, that the & is not escaped here. This only works if I write the prompt myself without the /meme command.

I hope this helps.

One wild guess: Might it have to do with Mattermost being behind a reverse proxy or not?

commented

Dunno if this adds anything useful, but this is what I see in the nginx reverse proxy log after entering /meme aliens "Test" "Test":

"GET /api/v4/image?url=https%3A%2F%2Fchat.domain.de%2Fplugins%2Fmemes%2Ftemplates%2Fancient-aliens.jpg%3Ftext%3DTest%26amp%3Btext%3DTest HTTP/1.1"  302
"GET /plugins/memes/templates/ancient-aliens.jpg?text=Test&text=Test HTTP/1.1"  200

Our config's following https://docs.mattermost.com/install/config-proxy-nginx.html

I have the very same issue on desktop and web version, but it renders correctly on the iOS version.

I digged into our Mattermost server. The link in the Post in the database is the correct one, without any semicolons. So the issue is that the Mattermost webapp renders this link into an encoded form and introduces an & in the process.

So either someone knows or finds out where that encoding happens and it get's fixed in the Mattermost webapp files, or the plugin catches this and just replaces & with &