diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-10-29 15:25:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 15:25:31 (GMT) |
commit | 191a93905a84f272b2232701dc5dcc69987330f5 (patch) | |
tree | 5d517ce51fffee5e9edd0b6cf1dfe1ce0cdc3c85 | |
parent | 6742b0dfb61ebdb92a1ff633ec071734b5d39981 (diff) | |
download | cpython-191a93905a84f272b2232701dc5dcc69987330f5.zip cpython-191a93905a84f272b2232701dc5dcc69987330f5.tar.gz cpython-191a93905a84f272b2232701dc5dcc69987330f5.tar.bz2 |
[3.10] bpo-45628: Check all parts of the suffix for an extension match. (GH-29310) (GH-29314)
-rw-r--r-- | Lib/logging/handlers.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 4dcbe45..4e8f0a8 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -371,8 +371,13 @@ class TimedRotatingFileHandler(BaseRotatingHandler): for fileName in fileNames: if fileName[:plen] == prefix: suffix = fileName[plen:] - if self.extMatch.match(suffix): - result.append(os.path.join(dirName, fileName)) + # See bpo-45628: The date/time suffix could be anywhere in the + # filename + parts = suffix.split('.') + for part in parts: + if self.extMatch.match(part): + result.append(os.path.join(dirName, fileName)) + break if len(result) < self.backupCount: result = [] else: |