mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Don't allow Atom to open files larger than 1MB
Temporary measure until we can get this working with telepath.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
pathWatcher = require 'pathwatcher'
|
||||
Q = require 'q'
|
||||
@@ -76,6 +77,9 @@ class File
|
||||
if not @exists()
|
||||
promise = Q(null)
|
||||
else if not @cachedContents? or flushCache
|
||||
if fs.statSync(@getPath()).size >= 1048576 # 1MB
|
||||
throw new Error("Atom can only handle files < 1MB, for now.")
|
||||
|
||||
deferred = Q.defer()
|
||||
promise = deferred.promise
|
||||
content = []
|
||||
|
||||
Reference in New Issue
Block a user