kopia lustrzana https://github.com/c9/core
make sure that broken paths are not added to fs.cache
rodzic
244ec1500f
commit
effb061c5e
|
@ -57,9 +57,9 @@
|
||||||
"c9.ide.language.javascript": "#ec9ecf31cf",
|
"c9.ide.language.javascript": "#ec9ecf31cf",
|
||||||
"c9.ide.language.javascript.immediate": "#9a2cce9121",
|
"c9.ide.language.javascript.immediate": "#9a2cce9121",
|
||||||
"c9.ide.language.javascript.eslint": "#8832423ad1",
|
"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.javascript.infer": "#ebb2daf81a",
|
||||||
"c9.ide.language.jsonalyzer": "#3ae6c1545b",
|
"c9.ide.language.jsonalyzer": "#d82c60fcb9",
|
||||||
"c9.ide.collab": "#b94018ab2b",
|
"c9.ide.collab": "#b94018ab2b",
|
||||||
"c9.ide.local": "#2bfd7ff051",
|
"c9.ide.local": "#2bfd7ff051",
|
||||||
"c9.ide.find": "#989c06e6a7",
|
"c9.ide.find": "#989c06e6a7",
|
||||||
|
|
|
@ -289,14 +289,14 @@ define(function(require, exports, module) {
|
||||||
var newPath = e.args[1];
|
var newPath = e.args[1];
|
||||||
var parent = findNode(dirname(newPath));
|
var parent = findNode(dirname(newPath));
|
||||||
|
|
||||||
//Validation
|
// Validation
|
||||||
var toNode = findNode(newPath);
|
var toNode = findNode(newPath);
|
||||||
|
|
||||||
if (parent) { //Dir is in cache
|
if (parent) { // Dir is in cache
|
||||||
if (toNode)
|
if (toNode)
|
||||||
deleteNode(toNode);
|
deleteNode(toNode);
|
||||||
|
|
||||||
createNode(newPath, null, node); // Move node
|
createNode(newPath, null, node); // Move node
|
||||||
recurPathUpdate(node, oldPath, newPath);
|
recurPathUpdate(node, oldPath, newPath);
|
||||||
|
|
||||||
e.undo = function(){
|
e.undo = function(){
|
||||||
|
@ -480,6 +480,11 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNode(path, stat, updateNode, updating) {
|
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]) {
|
if (orphans[path]) {
|
||||||
updateNode = orphans[path];
|
updateNode = orphans[path];
|
||||||
delete orphans[path];
|
delete orphans[path];
|
||||||
|
|
|
@ -62,6 +62,13 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
if (typeof args[args.length - 1] != "function")
|
if (typeof args[args.length - 1] != "function")
|
||||||
throw new Error("Missing callback for " + name);
|
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();
|
var original_callback = args.pop();
|
||||||
|
|
||||||
|
|
|
@ -961,10 +961,15 @@ define(function(require, exports, module) {
|
||||||
if (node === false || path.charAt(0) == "!")
|
if (node === false || path.charAt(0) == "!")
|
||||||
return increment();
|
return increment();
|
||||||
|
|
||||||
|
if (!/^[!~/]/.test(path)) {
|
||||||
|
console.error("invalid path", path);
|
||||||
|
delete expandedList[path];
|
||||||
|
return increment();
|
||||||
|
}
|
||||||
|
|
||||||
if (node && node.status == "loaded") {
|
if (node && node.status == "loaded") {
|
||||||
expandNode(node);
|
expandNode(node);
|
||||||
increment();
|
return increment();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.readdir(path, function(err, data) {
|
fs.readdir(path, function(err, data) {
|
||||||
|
|
Ładowanie…
Reference in New Issue