This commit is contained in:
Jaiwanth 2021-08-14 00:14:57 +05:30
parent 5c78acfca4
commit 3efa699b88
7 changed files with 23 additions and 22 deletions

View file

@ -86,6 +86,7 @@ export default class MAudioBody extends React.PureComponent<IBodyProps, IState>
if (this.props.forExport) { if (this.props.forExport) {
const content = this.props.mxEvent.getContent(); const content = this.props.mxEvent.getContent();
// During export, the content url will point to the MSC, which will later point to a local url
const contentUrl = content.file?.url || content.url; const contentUrl = content.file?.url || content.url;
return ( return (
<span className="mx_MAudioBody"> <span className="mx_MAudioBody">

View file

@ -213,6 +213,7 @@ export default class MFileBody extends React.Component<IProps, IState> {
if (this.props.forExport) { if (this.props.forExport) {
const content = this.props.mxEvent.getContent(); const content = this.props.mxEvent.getContent();
// During export, the content url will point to the MSC, which will later point to a local url
return <span className="mx_MFileBody"> return <span className="mx_MFileBody">
<a href={content.file?.url || content.url}> <a href={content.file?.url || content.url}>
{ placeholder } { placeholder }

View file

@ -164,7 +164,8 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
protected getContentUrl(): string { protected getContentUrl(): string {
const content: IMediaEventContent = this.props.mxEvent.getContent(); const content: IMediaEventContent = this.props.mxEvent.getContent();
if (this.props.forExport) return content.url || content.file.url; // During export, the content url will point to the MSC, which will later point to a local url
if (this.props.forExport) return content.url || content.file?.url;
if (this.media.isEncrypted) { if (this.media.isEncrypted) {
return this.state.decryptedUrl; return this.state.decryptedUrl;
} else { } else {

View file

@ -78,6 +78,7 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
private getContentUrl(): string|null { private getContentUrl(): string|null {
const content = this.props.mxEvent.getContent<IMediaEventContent>(); const content = this.props.mxEvent.getContent<IMediaEventContent>();
// During export, the content url will point to the MSC, which will later point to a local url
if (this.props.forExport) return content.file?.url || content.url; if (this.props.forExport) return content.file?.url || content.url;
const media = mediaFromContent(content); const media = mediaFromContent(content);
if (media.isEncrypted) { if (media.isEncrypted) {

View file

@ -2329,25 +2329,6 @@
"There was an error updating your community. The server is unable to process your request.": "There was an error updating your community. The server is unable to process your request.", "There was an error updating your community. The server is unable to process your request.": "There was an error updating your community. The server is unable to process your request.",
"Update community": "Update community", "Update community": "Update community",
"An error has occurred.": "An error has occurred.", "An error has occurred.": "An error has occurred.",
"Enter a number between %(min)s and %(max)s": "Enter a number between %(min)s and %(max)s",
"Size can only be a number between %(min)s MB and %(max)s MB": "Size can only be a number between %(min)s MB and %(max)s MB",
"Number of messages can only be a number between %(min)s and %(max)s": "Number of messages can only be a number between %(min)s and %(max)s",
"Number of messages": "Number of messages",
"MB": "MB",
"Export Cancelled": "Export Cancelled",
"The export was cancelled successfully": "The export was cancelled successfully",
"Export Successful": "Export Successful",
"Your messages were successfully exported": "Your messages were successfully exported",
"Are you sure you want to stop exporting your data? If you do, you'll need to start over.": "Are you sure you want to stop exporting your data? If you do, you'll need to start over.",
"Stop": "Stop",
"Exporting your data": "Exporting your data",
"Export Chat": "Export Chat",
"Select from the options below to export chats from your timeline": "Select from the options below to export chats from your timeline",
"Format": "Format",
"Size Limit": "Size Limit",
"Include Attachments": "Include Attachments",
"Processing...": "Processing...",
"Export": "Export",
"Feedback sent": "Feedback sent", "Feedback sent": "Feedback sent",
"Rate %(brand)s": "Rate %(brand)s", "Rate %(brand)s": "Rate %(brand)s",
"Tell us below how you feel about %(brand)s so far.": "Tell us below how you feel about %(brand)s so far.", "Tell us below how you feel about %(brand)s so far.": "Tell us below how you feel about %(brand)s so far.",
@ -3048,6 +3029,24 @@
"Space Autocomplete": "Space Autocomplete", "Space Autocomplete": "Space Autocomplete",
"Users": "Users", "Users": "Users",
"User Autocomplete": "User Autocomplete", "User Autocomplete": "User Autocomplete",
"Enter a number between %(min)s and %(max)s": "Enter a number between %(min)s and %(max)s",
"Size can only be a number between %(min)s MB and %(max)s MB": "Size can only be a number between %(min)s MB and %(max)s MB",
"Number of messages can only be a number between %(min)s and %(max)s": "Number of messages can only be a number between %(min)s and %(max)s",
"Number of messages": "Number of messages",
"MB": "MB",
"Export Cancelled": "Export Cancelled",
"The export was cancelled successfully": "The export was cancelled successfully",
"Export Successful": "Export Successful",
"Your messages were successfully exported": "Your messages were successfully exported",
"Are you sure you want to stop exporting your data? If you do, you'll need to start over.": "Are you sure you want to stop exporting your data? If you do, you'll need to start over.",
"Stop": "Stop",
"Exporting your data": "Exporting your data",
"Export Chat": "Export Chat",
"Select from the options below to export chats from your timeline": "Select from the options below to export chats from your timeline",
"Format": "Format",
"Size Limit": "Size Limit",
"Include Attachments": "Include Attachments",
"Export": "Export",
"We'll store an encrypted copy of your keys on our server. Secure your backup with a Security Phrase.": "We'll store an encrypted copy of your keys on our server. Secure your backup with a Security Phrase.", "We'll store an encrypted copy of your keys on our server. Secure your backup with a Security Phrase.": "We'll store an encrypted copy of your keys on our server. Secure your backup with a Security Phrase.",
"For maximum security, this should be different from your account password.": "For maximum security, this should be different from your account password.", "For maximum security, this should be different from your account password.": "For maximum security, this should be different from your account password.",
"Enter a Security Phrase": "Enter a Security Phrase", "Enter a Security Phrase": "Enter a Security Phrase",

View file

@ -22,7 +22,6 @@ import { haveTileForEvent } from "../../components/views/rooms/EventTile";
import { ExportType } from "./exportUtils"; import { ExportType } from "./exportUtils";
import { IExportOptions } from "./exportUtils"; import { IExportOptions } from "./exportUtils";
import { EventType } from "matrix-js-sdk/src/@types/event"; import { EventType } from "matrix-js-sdk/src/@types/event";
import { MutableRefObject } from "react";
export default class JSONExporter extends Exporter { export default class JSONExporter extends Exporter {
protected totalSize = 0; protected totalSize = 0;

View file

@ -23,7 +23,6 @@ import { haveTileForEvent } from "../../components/views/rooms/EventTile";
import { ExportType } from "./exportUtils"; import { ExportType } from "./exportUtils";
import { IExportOptions } from "./exportUtils"; import { IExportOptions } from "./exportUtils";
import { textForEvent } from "../../TextForEvent"; import { textForEvent } from "../../TextForEvent";
import { MutableRefObject } from "react";
export default class PlainTextExporter extends Exporter { export default class PlainTextExporter extends Exporter {
protected totalSize: number; protected totalSize: number;