Generate unique filename for cached file
(self, url: str, media_type: str)
| 254 | ) |
| 255 | |
| 256 | def _generate_cache_filename(self, url: str, media_type: str) -> str: |
| 257 | """Generate unique filename for cached file""" |
| 258 | # Use URL hash as filename |
| 259 | url_hash = hashlib.md5(url.encode()).hexdigest() |
| 260 | ext = self._guess_extension(url, media_type) |
| 261 | |
| 262 | return f"{url_hash}{ext}" |
| 263 | |
| 264 | def _normalize_cache_error(self, error: Exception) -> str: |
| 265 | """整理缓存错误,避免将底层命令异常直接暴露给用户。""" |
no test coverage detected