Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

URL preview shows error on JetBrains YouTrack links #14118

Open
babolivier opened this issue Oct 10, 2022 · 3 comments
Open

URL preview shows error on JetBrains YouTrack links #14118

babolivier opened this issue Oct 10, 2022 · 3 comments
Labels
A-URL-Preview Issues related to generating server-side previews of remote URLs O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@babolivier
Copy link
Contributor

babolivier commented Oct 10, 2022

Seen just now in #synapse-dev:

image

The link is https://youtrack.jetbrains.com/issue/PY-54833/Pycharm-deletes-existing-poetry-environment

While Synapse itself is not failing to generate the preview, it seems to not be sending the correct data to the remote end.
I've tried it in a few other messengers. Discord seems to also fail to generate a preview but in this case just doesn't show anything client-side:

image

Slack on the other hand seems to be succeeding:

image

@babolivier babolivier added S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. O-Uncommon Most users are unlikely to come across this or unexpected workflow A-URL-Preview Issues related to generating server-side previews of remote URLs labels Oct 10, 2022
@DMRobertson
Copy link
Contributor

The source for that page
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width">
  <meta name="apple-itunes-app" content="app-id=1028024655">
  <link rel="manifest" href="manifest.json">
  <title rg-page-title delimiter="{{' – '}}" no-title="YouTrack"></title>

  
  <base href="/">
  

  <link rel="shortcut icon" href="static/favicon.ico?3c05e1a5b709165a5c4e825adf27273a?3c05e1a5b709165a5c4e825adf27273a" type="image/x-icon" sizes="16x16 32x32"/>
 <link rel="apple-touch-icon" sizes="57x57" href="static/apple-touch-icon-57x57.png?553aad996d56c43a239de341e4d3a035?553aad996d56c43a239de341e4d3a035"/>
 <link rel="apple-touch-icon" sizes="60x60" href="static/apple-touch-icon-60x60.png?b552ef159b72e314460e31281ae58d3e?b552ef159b72e314460e31281ae58d3e"/>
 <link rel="apple-touch-icon" sizes="72x72" href="static/apple-touch-icon-72x72.png?868c75e482211f7eb5e00d514490cf82?868c75e482211f7eb5e00d514490cf82"/>
 <link rel="apple-touch-icon" sizes="76x76" href="static/apple-touch-icon-76x76.png?301b4ee73db2aeb230c05ec4fb933854?301b4ee73db2aeb230c05ec4fb933854"/>
 <link rel="apple-touch-icon" sizes="114x114" href="static/apple-touch-icon-114x114.png?f8577d12dd7080201e7fdc4233862a25?f8577d12dd7080201e7fdc4233862a25"/>
 <link rel="apple-touch-icon" sizes="120x120" href="static/apple-touch-icon-120x120.png?8958600b1a617c6fd6ea2b54102aedc3?8958600b1a617c6fd6ea2b54102aedc3"/>
 <link rel="apple-touch-icon" sizes="144x144" href="static/apple-touch-icon-144x144.png?6d3050fce562d6ca8fbefc8613b99a16?6d3050fce562d6ca8fbefc8613b99a16"/>
 <link rel="apple-touch-icon" sizes="152x152" href="static/apple-touch-icon-152x152.png?588e3a4193375877258b650210748948?588e3a4193375877258b650210748948"/>
 <link rel="apple-touch-icon" sizes="180x180" href="static/apple-touch-icon-180x180.png?8fd974abc28cce6ee4f816ab2fdc4ae1?8fd974abc28cce6ee4f816ab2fdc4ae1"/>
 <link rel="mask-icon" href="static/apple-mask-icon.svg?68c959aed7d5ecb39cf1ea6c4c403ae5?68c959aed7d5ecb39cf1ea6c4c403ae5" color="black"/>
 <meta name="msapplication-TileColor" content="#000000"/>
 <meta name="msapplication-TileImage" content="static/mstile-144x144.png?acb8c9cfe266b62b36139533c6c8438c?acb8c9cfe266b62b36139533c6c8438c"/>
 <meta name="msapplication-square70x70logo" content="static/mstile-70x70.png?c000672d960936509ee027c7fb248d32?c000672d960936509ee027c7fb248d32"/>
 <meta name="msapplication-square150x150logo" content="static/mstile-150x150.png?c7977ba2a677d2fca50c96abd072654a?c7977ba2a677d2fca50c96abd072654a"/>
 <meta name="msapplication-wide310x150logo" content="static/mstile-310x150.png?c8016c9e43e484d7fc603b533a011ce3?c8016c9e43e484d7fc603b533a011ce3"/>
 <meta name="msapplication-square310x310logo" content="static/mstile-310x310.png?58e6cf2c144245512fe11ed58150aeb3?58e6cf2c144245512fe11ed58150aeb3"/>
</head>
<body class="global" rg-shortcuts-app shortcuts-loop>

<div class="app" ng-if="$root.isBootstrapped">
  <div class="app__container">
      <yt-header class="app__header"></yt-header>

      <div ng-if="$root.applicationError" style="min-height: 360px;">
        <yt-error code="{{$root.applicationError.status}}" guest="$root.applicationError.guest"></yt-error>
      </div>

      <div ng-if="!$root.applicationError" class="app__view-container">
        <div class="app__view" ng-view></div>
      </div>
  </div>
</div>
<div rg-dialog=""></div>

<yt-splash-screen ng-if="!$root.isBootstrapped"></yt-splash-screen>
<yt-page-loader></yt-page-loader>

<div data-nosnippet id="ring-old-browsers-message" class="ring-old-browsers-message ring-old-browsers-message_hidden" hidden>
  <span id="ring-old-browsers-message__smile" class="ring-old-browsers-message__smile" ng-non-bindable>{{ (&gt;_&lt;) }}</span>
  <br/><br/>
  <span id="ring-old-browsers-message__browser-message">This version of your browser is not supported.<br/>
          Try upgrading to the latest stable version.</span>
  <span id="ring-old-browsers-message__error-message">Something went seriously wrong.</span>
  <br/><br/>
  <!--[if IE 9]>
  <span>When using IE9.0 or higher, make sure that compatibility mode is disabled.</span>
  <![endif]-->
</div>

<script src="static/vendor.14b64b5b9fa8c1a94854.js"></script>
<script src="static/app.f37a204dea088328a5b0.js"></script>

</body>
</html>

There isn't any useful metadata in the head that I can see, nor any fallback text in the body.

it seems to not be sending the correct data to the remote end.

What makes you say this? I would guess that YouTrack serves up different HTML if the user agent says you're Slack.

I've tried it in a few other messengers. Discord seems to also fail to generate a preview but in this case just doesn't show anything client-side:

@babolivier
Copy link
Contributor Author

What makes you say this?

Well it obviously makes the decision about the data it sends back based on the info we send it.

To be clear I'm not necessarily saying that we should eg impersonate Slack. The resolution to this issue could very well be being better at detecting this kind of errors and just refusing to generate a preview in such cases (which Discord seems to do).

@clokep
Copy link
Member

clokep commented Oct 17, 2022

I investigated this a bit more (out of curiosity) and as @DMRobertson pointed out the page that gets returned is rather useless if you don't have JavaScript enabled. (It pretty much is a page saying "enable JavaScript" and then rebuilds the entire page via AJAX.)

Other things that I considered while investigating:

  • They do not have oEmbed autodiscovery in the HTML (or as a response header, although Synapse doesn't support that today).
  • The favicons given in the HTML are broken (they're missing an initial slash so are treated as relative instead of static), but it seems that browser default back to /favicon.ico in this case.
  • The message being rendered has a hidden attribute on the div, maybe we should ignore those when generating the description from the HTML?

Well it obviously makes the decision about the data it sends back based on the info we send it.

Yes, but it is possible that Slack has custom code to hit an API endpoint or do something different here, or maybe they're rendering with JavaScript enabled somehow?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-URL-Preview Issues related to generating server-side previews of remote URLs O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

3 participants