make sure that broken paths are not added to fs.cache

c9
nightwing 2015-03-17 23:40:56 +04:00
rodzic 244ec1500f
commit effb061c5e
4 zmienionych plików z 24 dodań i 7 usunięć

Wyświetl plik

@ -57,9 +57,9 @@
"c9.ide.language.javascript": "#ec9ecf31cf",
"c9.ide.language.javascript.immediate": "#9a2cce9121",
"c9.ide.language.javascript.eslint": "#8832423ad1",
"c9.ide.language.javascript.tern": "#008c837519",
"c9.ide.language.javascript.tern": "#7aab8b0b6a",
"c9.ide.language.javascript.infer": "#ebb2daf81a",
"c9.ide.language.jsonalyzer": "#3ae6c1545b",
"c9.ide.language.jsonalyzer": "#d82c60fcb9",
"c9.ide.collab": "#b94018ab2b",
"c9.ide.local": "#2bfd7ff051",
"c9.ide.find": "#989c06e6a7",

Wyświetl plik

@ -289,14 +289,14 @@ define(function(require, exports, module) {
var newPath = e.args[1];
var parent = findNode(dirname(newPath));
//Validation
// Validation
var toNode = findNode(newPath);
if (parent) { //Dir is in cache
if (parent) { // Dir is in cache
if (toNode)
deleteNode(toNode);
createNode(newPath, null, node); // Move node
createNode(newPath, null, node); // Move node
recurPathUpdate(node, oldPath, newPath);
e.undo = function(){
@ -480,6 +480,11 @@ define(function(require, exports, module) {
}
function createNode(path, stat, updateNode, updating) {
if (!/^[!~/]/.test(path)) {
var e = new Error("Refusing to add a node with misformed path to fs.cache");
return reportError(e, { path: path });
}
if (orphans[path]) {
updateNode = orphans[path];
delete orphans[path];

Wyświetl plik

@ -62,6 +62,13 @@ define(function(require, exports, module) {
if (typeof args[args.length - 1] != "function")
throw new Error("Missing callback for " + name);
if (!/^[!~/]/.test(path)) {
var e = new Error("Invalid path passed to fs");
e.data = { name: name, path: path };
setTimeout(function() { throw e });
return args[args.length - 1](e);
}
var original_callback = args.pop();

Wyświetl plik

@ -961,10 +961,15 @@ define(function(require, exports, module) {
if (node === false || path.charAt(0) == "!")
return increment();
if (!/^[!~/]/.test(path)) {
console.error("invalid path", path);
delete expandedList[path];
return increment();
}
if (node && node.status == "loaded") {
expandNode(node);
increment();
return;
return increment();
}
fs.readdir(path, function(err, data) {