Fix description cache

This commit is contained in:
Geometrically
2020-12-29 21:49:01 -07:00
parent 833cb99f41
commit fd33ff81c9
5 changed files with 32 additions and 9 deletions

View File

@@ -49,6 +49,29 @@ impl FileHost for S3Host {
)
.await?;
let provider = &*dotenv::var("S3_PROVIDER").unwrap();
if provider == "do" {
reqwest::Client::new()
.delete(format!(
"https://api.digitalocean.com/v2/cdn/endpoints/{}/cache",
self.bucket.name
))
.header(reqwest::header::CONTENT_TYPE, "application/json")
.header(
reqwest::header::AUTHORIZATION,
&self.bucket.credentials.secret_key,
)
.body(
serde_json::json!({
"files": vec![file_name],
})
.to_string(),
)
.send()
.await?;
}
Ok(UploadFileData {
file_id: file_name.to_string(),
file_name: file_name.to_string(),