Fossil SCM
chat: trim() leading/trailing spaces from message text before trying to send them.
Commit
b1d44f9ea713a6dd94c836502714165c9917a342102e25ebc7e7c970167b0692
Parent
d17f3d699b285ce…
1 file changed
+1
-1
+1
-1
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -823,11 +823,11 @@ | ||
| 823 | 823 | Chat.submitMessage = function(){ |
| 824 | 824 | const fd = new FormData(this.e.inputForm) |
| 825 | 825 | /* ^^^^ we don't really want/need the FORM element, but when |
| 826 | 826 | FormData() is default-constructed here then the server |
| 827 | 827 | segfaults, and i have no clue why! */; |
| 828 | - const msg = this.inputValue(); | |
| 828 | + const msg = this.inputValue().trim(); | |
| 829 | 829 | if(msg) fd.set('msg',msg); |
| 830 | 830 | const file = BlobXferState.blob || this.e.inputFile.files[0]; |
| 831 | 831 | if(file) fd.set("file", file); |
| 832 | 832 | if( !msg && !file ) return; |
| 833 | 833 | const self = this; |
| 834 | 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(); |
| 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 |