Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Markdown Images Don't Work Behind Proxy

Open tasmar opened this issue 10 years ago • 4 comments

There is a bug in the markdown images when you are behind a proxy where images will always be shown with 0px width and height.

tasmar avatar May 26 '16 14:05 tasmar

Can you show us an example, please?

marceloschmidt avatar May 27 '16 11:05 marceloschmidt

rc_markdown_image_bug rc_markdown_image_temp_fix

These are screenshots of a test environment behind a proxy. The first image shows that the markdown image is technically in RC, but is not viewable as there is no height and width settings. I am able to use a bookmarklet to add height and width to the images though, see the code snippet below.

javascript:(function(){
  var config = { 
    attributes: true, 
    childList: true, 
    characterData: true,
    subtree: true
  }; 
  var fixImages = function(){ 
    var images = document.querySelectorAll(".inline-image");
    for(var i=0; i<images.length; i++){
      images[i].style.height = "200px";
      images[i].style.width="300px";
    }; 
  }; 
  var observer = new MutationObserver(fixImages);
  var wrapper = document.querySelector(".wrapper");
  observer.observe(wrapper, config);
  fixImages();
})();

tasmar avatar May 27 '16 19:05 tasmar

Adding the script to Layout -> Custom Scripts also works, but only on the browsers. The images do not work in the electron app still, even with the custom script to provide a height and width to it.

tasmar avatar Jun 01 '16 18:06 tasmar

I think this does not happen anymore. If you still experience this issue, please check our issue guidelines again for help on providing additional information.

gabriellsh avatar Jan 30 '20 16:01 gabriellsh