@@ -275,40 +275,14 @@ def files(self, extension='.pck'):
275275 upper = self .__upper
276276 try :
277277 for f in os .listdir (self .__whichq ):
278- # By ignoring anything that doesn't end in .pck, we ignore
279- # tempfiles and avoid a race condition.
280278 if not f .endswith (extension ):
281279 continue
282- # Remove the extension to get the filebase
283280 filebase = f [:- len (extension )]
284281 try :
285- # Log warning for non-standard filenames but still process them
286- if '+' not in filebase :
287- full_path = os .path .join (self .__whichq , f )
288- mailman_log ('warning' , 'Non-standard file name format in queue directory (missing +): %s (full path: %s)' , f , full_path )
289- # Try to process the file anyway
290- try :
291- # Attempt to read the file to verify it's valid
292- with open (os .path .join (self .__whichq , f ), 'rb' ) as fp :
293- pickle .load (fp , fix_imports = True , encoding = 'utf-8' )
294- except Exception as e :
295- # If we can't read it, move it to shunt queue
296- try :
297- src = os .path .join (self .__whichq , f )
298- dst = os .path .join (mm_cfg .BADQUEUE_DIR , filebase + '.psv' )
299- if not os .path .exists (mm_cfg .BADQUEUE_DIR ):
300- os .makedirs (mm_cfg .BADQUEUE_DIR , 0o770 )
301- os .rename (src , dst )
302- mailman_log ('info' , 'Moved invalid file to shunt queue due to read error: %s -> %s' , f , dst )
303- continue
304- except Exception as move_e :
305- mailman_log ('error' , 'Failed to move invalid file %s to shunt queue: %s\n Traceback:\n %s' ,
306- f , str (move_e ), traceback .format_exc ())
307- continue
308-
309282 # Get the file's modification time
310283 mtime = os .path .getmtime (os .path .join (self .__whichq , f ))
311- if lower <= mtime < upper :
284+ # Only apply time bounds if they are set
285+ if lower is None or upper is None or (lower <= mtime < upper ):
312286 times [filebase ] = mtime
313287 except OSError :
314288 continue
0 commit comments