Fossil SCM

chat: trim() leading/trailing spaces from message text before trying to send them.

stephan 2021-01-04 14:04 trunk
Commit b1d44f9ea713a6dd94c836502714165c9917a342102e25ebc7e7c970167b0692
1 file changed +1 -1
+1 -1
--- src/chat.js
+++ src/chat.js
@@ -823,11 +823,11 @@
823823
Chat.submitMessage = function(){
824824
const fd = new FormData(this.e.inputForm)
825825
/* ^^^^ we don't really want/need the FORM element, but when
826826
FormData() is default-constructed here then the server
827827
segfaults, and i have no clue why! */;
828
- const msg = this.inputValue();
828
+ const msg = this.inputValue().trim();
829829
if(msg) fd.set('msg',msg);
830830
const file = BlobXferState.blob || this.e.inputFile.files[0];
831831
if(file) fd.set("file", file);
832832
if( !msg && !file ) return;
833833
const self = this;
834834
--- src/chat.js
+++ src/chat.js
@@ -823,11 +823,11 @@
823 Chat.submitMessage = function(){
824 const fd = new FormData(this.e.inputForm)
825 /* ^^^^ we don't really want/need the FORM element, but when
826 FormData() is default-constructed here then the server
827 segfaults, and i have no clue why! */;
828 const msg = this.inputValue();
829 if(msg) fd.set('msg',msg);
830 const file = BlobXferState.blob || this.e.inputFile.files[0];
831 if(file) fd.set("file", file);
832 if( !msg && !file ) return;
833 const self = this;
834
--- src/chat.js
+++ src/chat.js
@@ -823,11 +823,11 @@
823 Chat.submitMessage = function(){
824 const fd = new FormData(this.e.inputForm)
825 /* ^^^^ we don't really want/need the FORM element, but when
826 FormData() is default-constructed here then the server
827 segfaults, and i have no clue why! */;
828 const msg = this.inputValue().trim();
829 if(msg) fd.set('msg',msg);
830 const file = BlobXferState.blob || this.e.inputFile.files[0];
831 if(file) fd.set("file", file);
832 if( !msg && !file ) return;
833 const self = this;
834

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button