kopia lustrzana https://github.com/c9/core
Merge pull request +13769 from c9/vfs-ide-fix-crash
fix vfs crashing when file is named constructorpull/299/head
commit
980d467f16
|
@ -39,7 +39,7 @@ module.exports = function setup(mount, vfs, mountOptions) {
|
|||
if (path) {
|
||||
entry.href = path + entry.name;
|
||||
var mime = entry.linkStat ? entry.linkStat.mime : entry.mime;
|
||||
if (mime && mime.match(/(directory|folder)$/)) {
|
||||
if (/(directory|folder)$/.test(mime)) {
|
||||
entry.href += "/";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,15 @@ var pathBasename = require("path").basename;
|
|||
var dirname = require("path").dirname;
|
||||
var basename = require("path").basename;
|
||||
var Stream = require("stream").Stream;
|
||||
var getMime = require("simple-mime")("application/octet-stream");
|
||||
var getMime = (function(simpleMime) {
|
||||
// workaround for a bug in simple-mime
|
||||
return function(path) {
|
||||
var mime = simpleMime(path);
|
||||
if (typeof mime != "string")
|
||||
return "application/octet-stream"
|
||||
return mime;
|
||||
}
|
||||
})(require("simple-mime")());
|
||||
var vm = require("vm");
|
||||
var exists = fs.exists || require("path").exists;
|
||||
var crypto = require("crypto");
|
||||
|
|
|
@ -30,85 +30,43 @@ define(function(require, exports, module) {
|
|||
return '"' + name + '"';
|
||||
};
|
||||
|
||||
var SupportedIcons = {
|
||||
"c9search": "page_white_magnify",
|
||||
"js": "page_white_code",
|
||||
"jsx": "page_white_code_red",
|
||||
"ts": "page_white_code",
|
||||
"tsx": "page_white_code_red",
|
||||
"json": "page_white_code",
|
||||
"css": "css",
|
||||
"scss": "css",
|
||||
"sass": "css",
|
||||
"less": "css",
|
||||
"xml": "page_white_code_red",
|
||||
"svg": "page_white_picture",
|
||||
"php": "page_white_php",
|
||||
"phtml": "page_white_php",
|
||||
"html": "html",
|
||||
"xhtml": "html",
|
||||
"coffee": "page_white_cup",
|
||||
"py": "page_white_code",
|
||||
"go": "page_white_code",
|
||||
"java": "page_white_cup",
|
||||
"logic": "logiql",
|
||||
"ru": "page_white_ruby",
|
||||
"gemspec": "page_white_ruby",
|
||||
"rake": "page_white_ruby",
|
||||
"rb": "page_white_ruby",
|
||||
"c": "page_white_c",
|
||||
"cc": "page_white_c",
|
||||
"cpp": "page_white_cplusplus",
|
||||
"cxx": "page_white_c",
|
||||
"h": "page_white_h",
|
||||
"hh": "page_white_h",
|
||||
"hpp": "page_white_h",
|
||||
"bmp": "image",
|
||||
"djv": "image",
|
||||
"djvu": "image",
|
||||
"gif": "image",
|
||||
"ico": "image",
|
||||
"jpeg": "image",
|
||||
"jpg": "image",
|
||||
"pbm": "image",
|
||||
"pgm": "image",
|
||||
"png": "image",
|
||||
"pnm": "image",
|
||||
"ppm": "image",
|
||||
"psd": "image",
|
||||
"svgz": "image",
|
||||
"tif": "image",
|
||||
"tiff": "image",
|
||||
"xbm": "image",
|
||||
"xpm": "image",
|
||||
"pdf": "page_white_acrobat",
|
||||
"clj": "page_white_code",
|
||||
"ml": "page_white_code",
|
||||
"mli": "page_white_code",
|
||||
"cfm": "page_white_coldfusion",
|
||||
"sql": "page_white_database",
|
||||
"db": "page_white_database",
|
||||
"sh": "page_white_wrench",
|
||||
"bash": "page_white_wrench",
|
||||
"xq": "page_white_code",
|
||||
"xz": "page_white_zip",
|
||||
"gz": "page_white_zip",
|
||||
"bz": "page_white_zip",
|
||||
"zip": "page_white_zip",
|
||||
"tar": "page_white_zip",
|
||||
"rar": "page_white_compressed",
|
||||
"exe": "page_white_swoosh",
|
||||
"o": "page_white_swoosh",
|
||||
"lnk": "page_white_swoosh",
|
||||
"txt": "page_white_text",
|
||||
"settings": "page_white_gear",
|
||||
"run": "page_white_gear",
|
||||
"build": "page_white_gear",
|
||||
"gitignore": "page_white_gear",
|
||||
"profile": "page_white_gear",
|
||||
"bashrc": "page_white_gear",
|
||||
};
|
||||
|
||||
var SupportedIcons = (function() {
|
||||
var extToClass = Object.create(null);
|
||||
var classToExt = {
|
||||
"page_white_magnify": "c9search",
|
||||
"page_white_code": ["clj", "go", "js", "json", "ml", "mli", "py", "ts", "xq"],
|
||||
"page_white_code_red": ["jsx", "tsx", "xml"],
|
||||
"css": ["css", "less", "sass", "scss"],
|
||||
"page_white_picture": "svg",
|
||||
"page_white_php": ["php", "phtml"],
|
||||
"html": ["html", "xhtml"],
|
||||
"page_white_cup": ["coffee", "java"],
|
||||
"logiql": "logic",
|
||||
"page_white_ruby": ["gemspec", "rake", "rb", "ru"],
|
||||
"page_white_c": ["c", "cc", "cxx"],
|
||||
"page_white_cplusplus": "cpp",
|
||||
"page_white_h": ["h", "hh", "hpp"],
|
||||
"image": ["bmp", "djv", "djvu", "gif", "ico", "jpeg", "jpg", "pbm", "pgm", "png", "pnm", "ppm", "psd", "svgz", "tif", "tiff", "xbm", "xpm"],
|
||||
"page_white_acrobat": "pdf",
|
||||
"page_white_coldfusion": "cfm",
|
||||
"page_white_database": ["db", "sql"],
|
||||
"page_white_wrench": ["bash", "sh"],
|
||||
"page_white_zip": ["bz", "gz", "tar", "xz", "zip"],
|
||||
"page_white_compressed": "rar",
|
||||
"page_white_swoosh": ["exe", "lnk", "o", "bin", "class"],
|
||||
"page_white_text": "txt",
|
||||
"page_white_gear": ["bashrc", "build", "gitignore", "profile", "run", "settings"]
|
||||
};
|
||||
Object.keys(classToExt).forEach(function(k) {
|
||||
var exts = classToExt[k];
|
||||
if (typeof exts == "string")
|
||||
exts = [exts];
|
||||
exts.forEach(function(ext) {
|
||||
extToClass[ext] = k;
|
||||
});
|
||||
});
|
||||
return extToClass;
|
||||
})();
|
||||
plugin.getFileIcon = function(name) {
|
||||
var icon = "page_white_text";
|
||||
var ext;
|
||||
|
|
|
@ -707,7 +707,7 @@ define(function(require, exports, module) {
|
|||
status: "pending",
|
||||
className: "projectRoot",
|
||||
isEditable: false,
|
||||
map: {}
|
||||
map: Object.create(null)
|
||||
};
|
||||
var root = {};
|
||||
root.map = Object.create(null);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
e
|
|
@ -0,0 +1 @@
|
|||
v
|
|
@ -0,0 +1 @@
|
|||
i
|
|
@ -0,0 +1 @@
|
|||
l
|
|
@ -209,6 +209,7 @@ define(function(require, exports, module) {
|
|||
}
|
||||
|
||||
function reconnect(callback) {
|
||||
if (!connection) return;
|
||||
connection.socket.setSocket(null);
|
||||
|
||||
vfsEndpoint.get(protocolVersion, function(err, urls) {
|
||||
|
@ -336,6 +337,11 @@ define(function(require, exports, module) {
|
|||
plugin.on("unload", function(){
|
||||
loaded = false;
|
||||
|
||||
if (consumer)
|
||||
consumer.disconnect();
|
||||
if (connection)
|
||||
connection.disconnect();
|
||||
|
||||
id = null;
|
||||
buffer = [];
|
||||
region = null;
|
||||
|
@ -346,6 +352,7 @@ define(function(require, exports, module) {
|
|||
serviceUrl = null;
|
||||
eioOptions = null;
|
||||
consumer = null;
|
||||
connection = null;
|
||||
vfs = null;
|
||||
showErrorTimer = null;
|
||||
showErrorTimerMessage = null;
|
||||
|
|
|
@ -271,6 +271,7 @@
|
|||
return cb();
|
||||
setTimeout.paused = true;
|
||||
window.app.services.vfs.connection.disconnect();
|
||||
window.app.services["vfs.endpoint"].clearCache();
|
||||
setTimeout.force(function() {
|
||||
setTimeout.paused = false;
|
||||
setTimeout.clear();
|
||||
|
|
Ładowanie…
Reference in New Issue