fix sending actual file when not scaled
This commit is contained in:
parent
da704f84d9
commit
160ca1067c
1 changed files with 30 additions and 21 deletions
|
|
@ -1113,6 +1113,7 @@ export default {
|
||||||
fileObj.dimensions = null;
|
fileObj.dimensions = null;
|
||||||
fileObj.type = file.type;
|
fileObj.type = file.type;
|
||||||
fileObj.actualSize = file.size;
|
fileObj.actualSize = file.size;
|
||||||
|
fileObj.actualFile = file
|
||||||
try {
|
try {
|
||||||
fileObj.dimensions = sizeOf(dataUriToBuffer(evt.target.result));
|
fileObj.dimensions = sizeOf(dataUriToBuffer(evt.target.result));
|
||||||
|
|
||||||
|
|
@ -1218,12 +1219,20 @@ export default {
|
||||||
this.$refs.attachment.value = null;
|
this.$refs.attachment.value = null;
|
||||||
if (this.isCurrentFileInputsAnArray) {
|
if (this.isCurrentFileInputsAnArray) {
|
||||||
let inputFiles = this.currentFileInputs.map(entry => {
|
let inputFiles = this.currentFileInputs.map(entry => {
|
||||||
|
// other than file type image
|
||||||
|
if(entry instanceof File) {
|
||||||
|
return entry;
|
||||||
|
} else {
|
||||||
if (entry.scaled && entry.useScaled) {
|
if (entry.scaled && entry.useScaled) {
|
||||||
// Send scaled version of image instead!
|
// Send scaled version of image instead!
|
||||||
return entry.scaled;
|
return entry.scaled;
|
||||||
|
} else {
|
||||||
|
// Send actual file image when not scaled!
|
||||||
|
return entry.actualFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return entry;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const promises = inputFiles.map(inputFile => util.sendImage(this.$matrix.matrixClient, this.roomId, inputFile, this.onUploadProgress));
|
const promises = inputFiles.map(inputFile => util.sendImage(this.$matrix.matrixClient, this.roomId, inputFile, this.onUploadProgress));
|
||||||
|
|
||||||
Promise.all(promises).then(() => {
|
Promise.all(promises).then(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue