mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Fixed meshctrl.js file upload.
This commit is contained in:
parent
fe086c345b
commit
9db21badb1
1 changed files with 4 additions and 2 deletions
|
@ -1731,10 +1731,12 @@ function connectTunnel(url) {
|
||||||
if (cmd.reqid == 'up') {
|
if (cmd.reqid == 'up') {
|
||||||
if ((cmd.action == 'uploadack') || (cmd.action == 'uploadstart')) {
|
if ((cmd.action == 'uploadack') || (cmd.action == 'uploadstart')) {
|
||||||
var buf = Buffer.alloc(4096);
|
var buf = Buffer.alloc(4096);
|
||||||
var len = require('fs').readSync(settings.uploadFile, buf, 0, 4096, settings.uploadPtr);
|
var len = require('fs').readSync(settings.uploadFile, buf, 1, 4095, settings.uploadPtr);
|
||||||
|
var start = 1;
|
||||||
settings.uploadPtr += len;
|
settings.uploadPtr += len;
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
settings.tunnelws.send(buf.slice(0, len));
|
if ((buf[1] == 0) || (buf[1] == 123)) { start = 0; buf[0] = 0; len++; } // If the buffer starts with 0 or 123, we must add an extra 0 at the start of the buffer
|
||||||
|
settings.tunnelws.send(buf.slice(start, start + len));
|
||||||
} else {
|
} else {
|
||||||
console.log('Upload done, ' + settings.uploadPtr + ' bytes sent.');
|
console.log('Upload done, ' + settings.uploadPtr + ' bytes sent.');
|
||||||
if (settings.uploadFile != null) { require('fs').closeSync(settings.uploadFile); }
|
if (settings.uploadFile != null) { require('fs').closeSync(settings.uploadFile); }
|
||||||
|
|
Loading…
Reference in a new issue