Handle falsy values for filename (#4766)

This commit is contained in:
Fayaz Ahmed 2022-05-31 16:38:24 +05:30 committed by GitHub
parent afc7c1ac64
commit 3f382e5979
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -29,8 +29,11 @@ export default {
},
computed: {
fileName() {
const filename = this.url.substring(this.url.lastIndexOf('/') + 1);
return filename;
if (this.url) {
const filename = this.url.substring(this.url.lastIndexOf('/') + 1);
return filename || this.$t('CONVERSATION.UNKNOWN_FILE_TYPE');
}
return this.$t('CONVERSATION.UNKNOWN_FILE_TYPE');
},
},
methods: {

View file

@ -30,6 +30,7 @@
"REPLYING_TO": "You are replying to:",
"REMOVE_SELECTION": "Remove Selection",
"DOWNLOAD": "Download",
"UNKNOWN_FILE_TYPE": "Unknown File",
"UPLOADING_ATTACHMENTS": "Uploading attachments...",
"SUCCESS_DELETE_MESSAGE": "Message deleted successfully",
"FAIL_DELETE_MESSSAGE": "Couldn't delete message! Try again",