Skip to content

Commit 920588e

Browse files
committed
review make object names unique for the same bso
thanks barry
1 parent 081276c commit 920588e

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

syncserver/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ slog-stdlog.workspace = true
3434
slog-term.workspace = true
3535
hmac.workspace = true
3636
thiserror.workspace = true
37+
uuid.workspace = true
3738

3839
actix-http = "3"
3940
actix-rt = "2"

syncserver/src/web/payload_offload.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::time::SystemTime;
2020
use google_cloud_auth::credentials::anonymous;
2121
use google_cloud_storage::client::Storage;
2222
use syncstorage_db::UserIdentifier;
23+
use uuid::Uuid;
2324

2425
use crate::{
2526
error::{ApiError, ApiErrorKind},
@@ -73,7 +74,13 @@ pub async fn upload_payload(
7374
bso_id: &str,
7475
payload: String,
7576
) -> Result<String, ApiError> {
76-
let object_name = format!("{}/{}/{}", user_id.fxa_uid, collection, bso_id);
77+
let object_name = format!(
78+
"{}/{}/{}/{}",
79+
user_id.fxa_uid,
80+
collection,
81+
bso_id,
82+
Uuid::new_v4().hyphenated()
83+
);
7784
let client = gcs_client(state).await?;
7885

7986
let custom_time: wkt::Timestamp = SystemTime::now()

0 commit comments

Comments
 (0)