fix: truncate remote actor username to VARCHAR(32); fix outbox URL by following 'first' link
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m33s
test / unit (pull_request) Failing after 10m46s
test / integration (pull_request) Failing after 16m54s
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m33s
test / unit (pull_request) Failing after 10m46s
test / integration (pull_request) Failing after 16m54s
This commit is contained in:
@@ -154,10 +154,16 @@ impl ActivityPubRepository for PgActivityPubRepository {
|
||||
return Ok(id);
|
||||
}
|
||||
let new_id = uuid::Uuid::new_v4();
|
||||
let handle = actor_ap_url
|
||||
let raw = actor_ap_url
|
||||
.path()
|
||||
.trim_start_matches('/')
|
||||
.replace('/', "_");
|
||||
// username column is VARCHAR(32); truncate long paths (e.g. UUID-based actor URLs)
|
||||
let handle = if raw.len() <= 32 {
|
||||
raw
|
||||
} else {
|
||||
format!("remote_{}", &new_id.to_string()[..13])
|
||||
};
|
||||
sqlx::query(
|
||||
"INSERT INTO users(id,username,email,password_hash,local,ap_id,created_at,updated_at)
|
||||
VALUES($1,$2,$3,'',false,$4,NOW(),NOW()) ON CONFLICT(ap_id) DO NOTHING",
|
||||
|
||||
Reference in New Issue
Block a user