fix: clean up OAuth token cache on provider deletion (#7908)

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vincenzo Palazzo
2026-03-17 18:54:11 +01:00
committed by GitHub
parent b4f018f6f9
commit 827175619a
14 changed files with 174 additions and 9 deletions
@@ -118,6 +118,14 @@ impl DiskCache {
tokio::fs::write(&self.cache_path, contents).await?;
Ok(())
}
async fn clear(&self) -> Result<()> {
match tokio::fs::remove_file(&self.cache_path).await {
Ok(()) => Ok(()),
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
Err(e) => Err(e.into()),
}
}
}
#[derive(Debug, serde::Serialize)]
@@ -134,6 +142,10 @@ pub struct GithubCopilotProvider {
}
impl GithubCopilotProvider {
pub async fn cleanup() -> Result<()> {
DiskCache::new().clear().await
}
fn payload_contains_image(payload: &Value) -> bool {
payload
.get("messages")