RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.16k stars 10.38k forks source link

Rocket.Chat mangles number in code block #7467

Open martinvonwittich opened 7 years ago

martinvonwittich commented 7 years ago

Rocket.Chat Version: 0.56.0 Running Instances: 1 DB Replicaset OpLog: Disabled Node Version: v4.5.0

I just pasted the following code block into Rocket.Chat:

```
redmine.iserv.eu /var/www/redmine/log # ll production.log 
-rw-r--r-- 1 www-data www-data 236M Jul 11 12:15 production.log
```

I would have expected Rocket.Chat to display the result like this:

redmine.iserv.eu /var/www/redmine/log # ll production.log 
-rw-r--r-- 1 www-data www-data 236M Jul 11 12:15 production.log

But for some reason, the 2 of 236M is missing and it is displayed like this?!

redmine.iserv.eu /var/www/redmine/log # ll production.log 
-rw-r--r-- 1 www-data www-data 36M Jul 11 12:15 production.log

I was able to reproduce this issue on https://demo.rocket.chat/channel/general , so if that server is running the most recent version, it is still affected.

edwardmuel commented 7 years ago

Seems to only happen with specific languages.

image

Could possibly be an issue with highlight.js: https://github.com/isagalaev/highlight.js/issues/1566

localguru commented 7 years ago

Can confirm on 0.57.1

Interesting is if you change the user "www-data" in your line to e.g. "wwwdata" the result is as expected

rc_blockcode

timkinnane commented 7 years ago

As @edwardmuel suggested, I've found similar problems with code blocks because they are assumed to be javascript by default and so apply javascript syntax colouring.

I have no idea what's happening with the numbers though, that's more likely a bad regex pattern.

I use ```markdown to render basic text code blocks, but I would prefer if Rocket.chat didn't actually presume javascript by default.

I'm happy to look at this issue if no one else takes it up, because I'd like to add some unit tests for the various regex replacement patterns throughout Rocket.chat, as I've seen a lot of related issues. I won't be able to do that for a couple weeks at least though.

Hudell commented 6 years ago

The problem is still happening on the current version of RC.

dannysauer commented 4 years ago

I opened https://github.com/highlightjs/highlight.js/issues/2355 today because it was still present in our version. Whoops. :D

Either way, looks like https://github.com/highlightjs/highlight.js/pull/2219 might have fixed this issue. So hopefully this can be closed once the bundled code is bumped to include the new stuff.

dannysauer commented 4 years ago

Weird. Who knew that simply making a comment would unassign @karlprieb . 🤷‍♂