mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-22 16:37:32 +00:00
fix: Check max rendezvous data size at the correct time
This commit is contained in:
1 file changed
+4
-4
@@ -105,10 +105,6 @@ impl Service {
|
||||
) -> Result<update_rendezvous_session::msc4388::Response> {
|
||||
let mut session = self.lock_session(id)?;
|
||||
|
||||
if data.len() > Self::MAX_DATA_SIZE_BYTES {
|
||||
return Err!(Request(TooLarge("Data too large")));
|
||||
}
|
||||
|
||||
// If the provided transaction ID was used already, we have to return
|
||||
// the sequence token that we returned last time it was used.
|
||||
// This makes session updates with the same transaction ID idempotent.
|
||||
@@ -126,6 +122,10 @@ impl Service {
|
||||
|
||||
let new_sequence_token = Self::create_token();
|
||||
|
||||
if data.len() > Self::MAX_DATA_SIZE_BYTES {
|
||||
return Err!(Request(TooLarge("Data too large")));
|
||||
}
|
||||
|
||||
session.data = data;
|
||||
session.last_sequence_token.clone_from(&new_sequence_token);
|
||||
session
|
||||
|
||||
Reference in new issue
Block a user