summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-08-31 13:50:45 +0200
committerJoas Schilling <coding@schilljs.com>2021-08-31 13:50:45 +0200
commit3bb5f63b72ef09acbea7056411e7d9d93b3d8f60 (patch)
tree34b06b62e1a9e0bcbae9c56e894348b199627898
parent4e88329489e48fbcc06ea71da1ade5be1a69a2a6 (diff)
Fix audio recordings in conversations with special chars and long names
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
index d40d0ed96..065f6016c 100644
--- a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
+++ b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
@@ -312,10 +312,13 @@ export default {
generateFileName() {
const token = this.$store.getters.getToken()
const conversation = this.$store.getters.conversation(token).name
+ .replace(/\/\\:%/gi, ' ') // Replace chars that are not allowed on the filesystem
+ .replace(/ +/gi, ' ') // Replace multiple replacement spaces with 1
const today = new Date()
let time = today.getFullYear() + '-' + ('0' + today.getMonth()).slice(-2) + '-' + ('0' + today.getDay()).slice(-2)
time += ' ' + ('0' + today.getHours()).slice(-2) + '-' + ('0' + today.getMinutes()).slice(-2) + '-' + ('0' + today.getSeconds()).slice(-2)
- return t('spreed', 'Talk recording from {time} ({conversation})', { time, conversation }) + '.wav'
+ const name = t('spreed', 'Talk recording from {time} ({conversation})', { time, conversation })
+ return name.substring(0, 246) + '.wav'
},
/**