1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix getLibraryEntry for files missing meta data

This commit is contained in:
Nick O'Leary 2019-05-21 23:30:59 +01:00
parent 42b60aef4e
commit 137a7ac48c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -66,15 +66,19 @@ function getFileBody(root,path) {
var buffer = Buffer.alloc(length);
while(read < size) {
var thisRead = fs.readSync(fd,buffer,0,length);
read += thisRead;
if (scanning) {
var data = remaining+buffer.slice(0,thisRead).toString();
read += thisRead;
var parts = data.split("\n");
remaining = parts.splice(-1)[0];
if (read < size) {
remaining = parts.splice(-1)[0];
} else {
remaining = "";
}
for (var i=0;i<parts.length;i+=1) {
if (! /^\/\/ \w+: /.test(parts[i])) {
scanning = false;
body += parts[i]+"\n";
body += (body.length > 0?"\n":"")+parts[i];
}
}
if (!scanning) {