Skip to content

Commit

Permalink
(fix) image type with multiple dots in file name
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine92190 committed Dec 25, 2020
1 parent ef56be2 commit 2b8d9a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ChatWindow/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,13 @@ export default {
const file = files[0]
const fileURL = URL.createObjectURL(file)
const blobFile = await fetch(fileURL).then(res => res.blob())
const typeIndex = file.name.lastIndexOf('.');
this.file = {
blob: blobFile,
name: file.name.split('.')[0],
name: file.name.substring(0, typeIndex),
size: file.size,
type: file.name.split('.')[1] || file.type,
type: file.name.substring(typeIndex) || file.type,
localUrl: fileURL
}
if (this.isImageCheck(this.file)) this.imageFile = fileURL
Expand Down

0 comments on commit 2b8d9a5

Please sign in to comment.