implemented maxmemberkb limit for multidoc (e.g. archive) members
This commit is contained in:
@@ -17,6 +17,11 @@ class RclExecM:
|
||||
def __init__(self):
|
||||
self.myname = os.path.basename(sys.argv[0])
|
||||
self.mimetype = ""
|
||||
self.maxmembersize = int(os.environ.get("RECOLL_FILTER_MAXMEMBERKB"))
|
||||
if self.maxmembersize:
|
||||
self.maxmembersize = self.maxmembersize * 1024
|
||||
else:
|
||||
self.maxmembersize = 50 * 1024 * 1024
|
||||
|
||||
def rclog(self, s, doexit = 0, exitvalue = 1):
|
||||
print >> sys.stderr, "RCLMFILT:", self.myname, ":", s
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ class RarExtractor:
|
||||
|
||||
if not isdir:
|
||||
try:
|
||||
if rarinfo.file_size > 50 * 1024 * 1024:
|
||||
if rarinfo.file_size > self.em.maxmembersize:
|
||||
self.em.rclog("extractone: entry %s size %d too big" %
|
||||
(ipath, rarinfo.file_size))
|
||||
docdata = ""
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ class TarExtractor:
|
||||
docdata = ""
|
||||
try:
|
||||
info = self.tar.getmember(ipath)
|
||||
if info.size > 50 * 1024 * 1024:
|
||||
if info.size > self.em.maxmembersize:
|
||||
# skip
|
||||
docdata = ""
|
||||
self.em.rclog("extractone: entry %s size %d too big" %
|
||||
|
||||
+2
-2
@@ -40,14 +40,14 @@ class ZipExtractor:
|
||||
def __init__(self, em):
|
||||
self.currentindex = 0
|
||||
self.em = em
|
||||
|
||||
|
||||
def extractone(self, ipath):
|
||||
#self.em.rclog("extractone: [%s]" % ipath)
|
||||
docdata = ""
|
||||
try:
|
||||
info = self.zip.getinfo(ipath)
|
||||
# There could be a 4GB Iso in the zip. We have to set a limit
|
||||
if info.file_size > 50 * 1024*1024:
|
||||
if info.file_size > self.em.maxmembersize:
|
||||
self.em.rclog("extractone: entry %s size %d too big" %
|
||||
(ipath, info.file_size))
|
||||
docdata = ""
|
||||
|
||||
Reference in New Issue
Block a user