Enforce newlines at the end.
This commit is contained in:
parent
fda3901691
commit
e671e502c3
6
index.ts
6
index.ts
@ -59,7 +59,11 @@ let srv = net.createServer(function(socket: net.Socket) {
|
||||
const store = db.prepare("INSERT INTO messages VALUES (?,?,?)");
|
||||
let t = new Date;
|
||||
let a = addr;
|
||||
let m = String(data.slice(1)).replace("/\n/g", "\\n").replace("/\x1b/g", "\\x1b");
|
||||
let s = data.slice(1);
|
||||
if (s.slice(-1) != "\n") {
|
||||
s += "\n";
|
||||
}
|
||||
let m = String(s).replace("/\n/g", "\\n").replace("/\x1b/g", "\\x1b");
|
||||
msize += textEncoder.encode(msgToString(t, a, m)).length
|
||||
store.run(Number(t),a,m);
|
||||
store.finalize();
|
||||
|
Loading…
Reference in New Issue
Block a user