Skip to content

Commit

Permalink
added comment, use full url
Browse files Browse the repository at this point in the history
  • Loading branch information
JediWattson committed Dec 7, 2022
1 parent 2226040 commit c6e5b53
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/AttachmentCarousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ class AttachmentCarousel extends React.Component {
if (originalMessage && originalMessage.html) {
const matchesIt = originalMessage.html.matchAll(CONST.REGEX.ATTACHMENT_DATA);
const matches = [...matchesIt];

// matchAll captured both source url and name of the attachment
if (matches.length === 2) {
const [src, name] = matches;
if ((this.state.sourceURL && src[2].includes(this.state.sourceURL))
|| (!this.state.sourceURL && src[2].includes(this.props.sourceURL))) {
page = attachmentsAccumulator.length;
}
const {pathname} = new URL(src[2]);
attachmentsAccumulator.push({sourceURL: pathname, file: {name: name[2]}});
const {href} = new URL(src[2]);
attachmentsAccumulator.push({sourceURL: href, file: {name: name[2]}});
}
}
return attachmentsAccumulator;
Expand Down

0 comments on commit c6e5b53

Please sign in to comment.