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() {
|
_getContentUrl() {
|
||||||
if (this.props.forExport) return "forExport";
|
if (this.props.forExport) return this.props.mxEvent.getContent().url;
|
||||||
const media = mediaFromContent(this.props.mxEvent.getContent());
|
const media = mediaFromContent(this.props.mxEvent.getContent());
|
||||||
if (media.isEncrypted) {
|
if (media.isEncrypted) {
|
||||||
return this.state.decryptedUrl;
|
return this.state.decryptedUrl;
|
||||||
|
|
|
@ -172,7 +172,7 @@ export default class MImageBody extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_getContentUrl() {
|
_getContentUrl() {
|
||||||
if (this.props.forExport) return "forExport";
|
if (this.props.forExport) return this.props.mxEvent.getContent().url;
|
||||||
const media = mediaFromContent(this.props.mxEvent.getContent());
|
const media = mediaFromContent(this.props.mxEvent.getContent());
|
||||||
if (media.isEncrypted) {
|
if (media.isEncrypted) {
|
||||||
return this.state.decryptedUrl;
|
return this.state.decryptedUrl;
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default class MVideoBody extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getContentUrl(): string|null {
|
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());
|
const media = mediaFromContent(this.props.mxEvent.getContent());
|
||||||
if (media.isEncrypted) {
|
if (media.isEncrypted) {
|
||||||
return this.state.decryptedUrl;
|
return this.state.decryptedUrl;
|
||||||
|
|
|
@ -263,7 +263,9 @@ export default class HTMLExporter extends Exporter {
|
||||||
</MatrixClientContext.Provider>
|
</MatrixClientContext.Provider>
|
||||||
</div>
|
</div>
|
||||||
let eventTileMarkup = renderToStaticMarkup(eventTile);
|
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) {
|
if (hasAvatar) {
|
||||||
eventTileMarkup = eventTileMarkup.replace(
|
eventTileMarkup = eventTileMarkup.replace(
|
||||||
encodeURI(this.getAvatarURL(mxEv)).replace(/&/g, '&'),
|
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);
|
const date = new Date(typeof fileLike.lastModified === 'undefined' ? Date.now() : fileLike.lastModified);
|
||||||
|
|
||||||
if (fileLike.directory && !name.endsWith('/')) name += '/';
|
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);
|
const nameBuf = encoder.encode(name);
|
||||||
filenames.push(name);
|
filenames.push(name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue