mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-14 02:38:40 +03:00
Replace hard coded forExport string by mxc url
This commit is contained in:
parent
e404fa3cae
commit
6cbbc0ecb4
5 changed files with 8 additions and 5 deletions
|
@ -42,7 +42,7 @@ export default class MAudioBody extends React.Component {
|
|||
}
|
||||
|
||||
_getContentUrl() {
|
||||
if (this.props.forExport) return "forExport";
|
||||
if (this.props.forExport) return this.props.mxEvent.getContent().url;
|
||||
const media = mediaFromContent(this.props.mxEvent.getContent());
|
||||
if (media.isEncrypted) {
|
||||
return this.state.decryptedUrl;
|
||||
|
|
|
@ -172,7 +172,7 @@ export default class MImageBody extends React.Component {
|
|||
}
|
||||
|
||||
_getContentUrl() {
|
||||
if (this.props.forExport) return "forExport";
|
||||
if (this.props.forExport) return this.props.mxEvent.getContent().url;
|
||||
const media = mediaFromContent(this.props.mxEvent.getContent());
|
||||
if (media.isEncrypted) {
|
||||
return this.state.decryptedUrl;
|
||||
|
|
|
@ -78,7 +78,7 @@ export default class MVideoBody extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
|
||||
private getContentUrl(): string|null {
|
||||
if (this.props.forExport) return "forExport";
|
||||
if (this.props.forExport) return this.props.mxEvent.getContent().url;
|
||||
const media = mediaFromContent(this.props.mxEvent.getContent());
|
||||
if (media.isEncrypted) {
|
||||
return this.state.decryptedUrl;
|
||||
|
|
|
@ -263,7 +263,9 @@ export default class HTMLExporter extends Exporter {
|
|||
</MatrixClientContext.Provider>
|
||||
</div>
|
||||
let eventTileMarkup = renderToStaticMarkup(eventTile);
|
||||
if (filePath) eventTileMarkup = eventTileMarkup.replace(/(src=|href=)"forExport"/g, `$1"${filePath}"`);
|
||||
if (filePath) {
|
||||
eventTileMarkup = eventTileMarkup.split(mxEv.getContent().url).join(filePath);
|
||||
}
|
||||
if (hasAvatar) {
|
||||
eventTileMarkup = eventTileMarkup.replace(
|
||||
encodeURI(this.getAvatarURL(mxEv)).replace(/&/g, '&'),
|
||||
|
|
|
@ -136,7 +136,8 @@ export default function streamToZIP(underlyingSource: UnderlyingSource) {
|
|||
const date = new Date(typeof fileLike.lastModified === 'undefined' ? Date.now() : fileLike.lastModified);
|
||||
|
||||
if (fileLike.directory && !name.endsWith('/')) name += '/';
|
||||
if (files[name]) throw new Error('File already exists.');
|
||||
// if file already exists, do not enqueue
|
||||
if (files[name]) return;
|
||||
|
||||
const nameBuf = encoder.encode(name);
|
||||
filenames.push(name);
|
||||
|
|
Loading…
Reference in a new issue