Print this page
*** NO COMMENTS ***

Split Close
Expand all
Collapse all
          --- old/src/gui/modules/filelist.py
          +++ new/src/gui/modules/filelist.py
↓ open down ↓ 67 lines elided ↑ open up ↑
  68   68  
  69   69                  if not os.path.exists(os.path.dirname(final_path)):
  70   70                          os.makedirs(os.path.dirname(final_path))
  71   71  
  72   72                  portable.rename(os.path.join(download_dir, hashval), final_path)
  73   73  
  74   74                  # assign opener to actions in the list
  75   75                  try:
  76   76                          lis = self.fhash[hashval]
  77   77                  except KeyError:
  78      -                        # If the key isn't in the dictionary, the server
  79      -                        # sent us a file we didn't ask for.  In this
  80      -                        # case, we can't create an opener for it, so just
  81      -                        # leave it in the cache.
       78 +                        # If the key isn't in the dictionary, the server sent us
       79 +                        # a file we didn't ask for.  In this case, we can't
       80 +                        # create an opener for it, nor should we leave it in the
       81 +                        # cache.
       82 +                        os.remove(final_path)
  82   83                          return
  83   84  
       85 +                self._verify_content(lis[0], final_path)
       86 +
  84   87                  for action in lis:
  85   88                          action.data = self._make_opener(final_path)
  86   89  
  87   90                  # Remove successfully extracted items from the hash
  88   91                  # and adjust bean counters
  89   92                  self._del_hash(hashval)
  90   93  
  91   94                  @staticmethod
  92   95                  def _make_opener(filepath):
  93   96                          def opener():
↓ open down ↓ 17 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX