Skip to content

Commit

Permalink
Merge 674ab96 into 33d472c
Browse files Browse the repository at this point in the history
  • Loading branch information
hmhealey committed Mar 15, 2017
2 parents 33d472c + 674ab96 commit 963ee2f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions webapp/components/post_view/components/post_attachment.jsx
Expand Up @@ -184,6 +184,7 @@ class PostAttachment extends React.Component {
author.push(
<img
className='attachment__author-icon'
crossOrigin='anonymous'
src={data.author_icon}
key={'attachment__author-icon'}
height='14'
Expand Down Expand Up @@ -257,6 +258,7 @@ class PostAttachment extends React.Component {
image = (
<img
className='attachment__image'
crossOrigin='anonymous'
src={data.image_url}
/>
);
Expand All @@ -269,6 +271,7 @@ class PostAttachment extends React.Component {
className='attachment__thumb-container'
>
<img
crossOrigin='anonymous'
src={data.thumb_url}
/>
</div>
Expand Down
Expand Up @@ -201,6 +201,7 @@ export default class PostAttachmentOpenGraph extends React.Component {
element = this.wrapInSmallImageContainer(
<img
className={'attachment__image attachment__image--openraph'}
crossOrigin='anonymous'
src={imageUrl}
ref={(img) => {
this.smallImageElement = img;
Expand Down
2 changes: 2 additions & 0 deletions webapp/components/post_view/components/post_image.jsx
Expand Up @@ -67,6 +67,7 @@ export default class PostImageEmbed extends React.Component {
return (
<img
className='img-div placeholder'
crossOrigin='anonymous'
height='500px'
/>
);
Expand All @@ -75,6 +76,7 @@ export default class PostImageEmbed extends React.Component {
return (
<img
className='img-div'
crossOrigin='anonymous'
src={this.props.link}
/>
);
Expand Down
2 changes: 2 additions & 0 deletions webapp/components/profile_picture.jsx
Expand Up @@ -69,6 +69,7 @@ export default class ProfilePicture extends React.Component {
width={this.props.width}
height={this.props.width}
src={this.props.src}
crossOrigin='anonymous'
/>
<StatusIcon status={this.props.status}/>
</span>
Expand All @@ -82,6 +83,7 @@ export default class ProfilePicture extends React.Component {
width={this.props.width}
height={this.props.width}
src={this.props.src}
crossOrigin='anonymous'
/>
<StatusIcon status={this.props.status}/>
</span>
Expand Down
1 change: 1 addition & 0 deletions webapp/components/profile_popover.jsx
Expand Up @@ -182,6 +182,7 @@ export default class ProfilePopover extends React.Component {
height='128'
width='128'
key='user-popover-image'
crossOrigin='anonymous'
/>
);

Expand Down
10 changes: 5 additions & 5 deletions webapp/tests/formatting_imgs.test.jsx
Expand Up @@ -11,7 +11,7 @@ describe('Markdown.Imgs', function() {
it('Inline mage', function(done) {
assert.equal(
Markdown.format('![Mattermost](/images/icon.png)').trim(),
'<p><img src="/images/icon.png" alt="Mattermost" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img"></p>'
'<p><img src="/images/icon.png" alt="Mattermost" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></p>'
);

done();
Expand All @@ -20,7 +20,7 @@ describe('Markdown.Imgs', function() {
it('Image with hover text', function(done) {
assert.equal(
Markdown.format('![Mattermost](/images/icon.png "Mattermost Icon")').trim(),
'<p><img src="/images/icon.png" alt="Mattermost" title="Mattermost Icon" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img"></p>'
'<p><img src="/images/icon.png" alt="Mattermost" title="Mattermost Icon" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></p>'
);

done();
Expand All @@ -29,7 +29,7 @@ describe('Markdown.Imgs', function() {
it('Image with link', function(done) {
assert.equal(
Markdown.format('[![Mattermost](../../images/icon-76x76.png)](https://github.com/mattermost/platform)').trim(),
'<p><a class="theme markdown__link" href="https://github.com/mattermost/platform" rel="noreferrer" target="_blank"><img src="../../images/icon-76x76.png" alt="Mattermost" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img"></a></p>'
'<p><a class="theme markdown__link" href="https://github.com/mattermost/platform" rel="noreferrer" target="_blank"><img src="../../images/icon-76x76.png" alt="Mattermost" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></a></p>'
);

done();
Expand All @@ -38,7 +38,7 @@ describe('Markdown.Imgs', function() {
it('Image with width and height', function(done) {
assert.equal(
Markdown.format('![Mattermost](../../images/icon-76x76.png =50x76 "Mattermost Icon")').trim(),
'<p><img src="../../images/icon-76x76.png" alt="Mattermost" title="Mattermost Icon" width="50" height="76" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img"></p>'
'<p><img src="../../images/icon-76x76.png" alt="Mattermost" title="Mattermost Icon" width="50" height="76" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></p>'
);

done();
Expand All @@ -47,7 +47,7 @@ describe('Markdown.Imgs', function() {
it('Image with width', function(done) {
assert.equal(
Markdown.format('![Mattermost](../../images/icon-76x76.png =50 "Mattermost Icon")').trim(),
'<p><img src="../../images/icon-76x76.png" alt="Mattermost" title="Mattermost Icon" width="50" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img"></p>'
'<p><img src="../../images/icon-76x76.png" alt="Mattermost" title="Mattermost Icon" width="50" onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img" crossorigin="anonymous"></p>'
);

done();
Expand Down
1 change: 1 addition & 0 deletions webapp/utils/markdown.jsx
Expand Up @@ -152,6 +152,7 @@ class MattermostMarkdownRenderer extends marked.Renderer {
out += ' height="' + dimensions[1] + '"';
}
out += ' onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img"';
out += ' crossorigin="anonymous"';
out += this.options.xhtml ? '/>' : '>';
return out;
}
Expand Down

0 comments on commit 963ee2f

Please sign in to comment.