Fixes oembed error with ogImage URLs that start with double slash

pull/5314/head
Marcelo Schmidt 9 years ago
parent 2cf9a37266
commit 9135222da7
No known key found for this signature in database
GPG Key ID: CA48C21A7B66097E
  1. 5
      packages/rocketchat-oembed/client/oembedUrlWidget.coffee

@ -36,7 +36,10 @@ Template.oembedUrlWidget.helpers
url = decodedOgImage or this.meta.twitterImage
if url?[0] is '/' and this.parsedUrl?.host?
if url.indexOf('//') is 0
url = "#{this.parsedUrl.protocol}#{url}"
else if url.indexOf('/') is 0 and this.parsedUrl?.host?
url = "#{this.parsedUrl.protocol}//#{this.parsedUrl.host}#{url}"
return url

Loading…
Cancel
Save