Skip to content

Commit c124c80

Browse files
authored
Merge pull request psf#125 from sybrenstuvel/sybren-filecache-delete-crash-fix
Fix crash when FileCache.delete() is called on non-existing file.
2 parents 0c7eae5 + 07a251b commit c124c80

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cachecontrol/caches/file_cache.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ def set(self, key, value):
104104
def delete(self, key):
105105
name = self._fn(key)
106106
if not self.forever:
107-
os.remove(name)
107+
try:
108+
os.remove(name)
109+
except FileNotFoundError:
110+
pass
108111

109112

110113
def url_to_file_path(url, filecache):

0 commit comments

Comments
 (0)