diff --git a/src/routes/project_creation.rs b/src/routes/project_creation.rs index 6e97f6b12..afcfd2721 100644 --- a/src/routes/project_creation.rs +++ b/src/routes/project_creation.rs @@ -907,10 +907,11 @@ async fn process_icon_upload( ) .await?; + let hash = sha1::Sha1::from(&data).hexdigest(); let upload_data = file_host .upload_file( content_type, - &format!("data/{}/icon.{}", project_id, file_extension), + &format!("data/{}/{}.{}", project_id, hash, file_extension), data.freeze(), ) .await?; diff --git a/src/routes/users.rs b/src/routes/users.rs index 5501e2455..710b16ca8 100644 --- a/src/routes/users.rs +++ b/src/routes/users.rs @@ -354,10 +354,11 @@ pub async fn user_icon_edit( ) .await?; + let hash = sha1::Sha1::from(&bytes).hexdigest(); let upload_data = file_host .upload_file( content_type, - &format!("user/{}/icon.{}", user_id, ext.ext), + &format!("user/{}/{}.{}", user_id, hash, ext.ext), bytes.freeze(), ) .await?;