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:
parent
42b60aef4e
commit
137a7ac48c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user