Skip to content

Images stop rendering in chat after upgrade to v11.0.0 #3672

@rozhuk-im

Description

@rozhuk-im

Describe the bug
Images stop rendering in chat after upgrade to v11.0.0

To Reproduce
Login in chat, it display only URLs for media.

Expected behavior
As on 10.x display images, video, sound...

Screenshots
nope

Environment (please complete the following information):

  • Desktop
  • Chrome/Firefox - no matter
  • Converse.js version v11.0.0

Additional context
It is not browser cache problem.
I had try with almost empty config - not help.
There is no errors in console.

I do small debug and found:

  shouldRenderMedia(url, type) {
    let override;
    if (type === "image") {
      override = this.show_images;
    } else if (type === "audio") {
      override = this.embed_audio;
    } else if (type === "video") {
      override = this.embed_videos;
    }
    if (typeof override === "boolean") {
      return override;
    }
    return shouldRenderMediaFromURL(url, type);
  }

Here this.show_images always not "boolean" true so it go to shouldRenderMediaFromURL.

function isAllowedProtocolForMedia(url) {
  const {
    protocol
  } = window.location;
  if (["chrome-extension:", "file:"].includes(protocol)) {
    return true;
  }
  const uri = headless_utils.getURL(url);
  return protocol === "http:" || protocol === "https:" && ["https", "aesgcm"].includes(uri.protocol.toLowerCase());
}

function shouldRenderMediaFromURL(url_text, type) {
  if (!isAllowedProtocolForMedia(url_text)) {
    return false;
  }
  const may_render = shared_api.settings.get("render_media");
  const is_domain_allowed = isDomainAllowed(url_text, `allowed_${type}_domains`);
  if (Array.isArray(may_render)) {
    return is_domain_allowed && isDomainWhitelisted(may_render, url_text);
  } else {
    return is_domain_allowed && may_render;
  }
}

And here it always got false from isAllowedProtocolForMedia.
return protocol === "http:" || protocol === "https:" && ["https", aesgcm"].includes(uri.protocol.toLowerCase()); - this looks strange, brasses missed.

But for me ["https", "aesgcm"].includes(uri.protocol.toLowerCase()) = always false.

It is strange to see aesgcm since many TSL ciphers are possible, other than aesgcm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions