fix(router): fix truncation (#190)

closes #189
This commit is contained in:
OlivierDehaene 2023-04-17 16:51:53 +02:00 committed by GitHub
parent 7a1ba58557
commit c13b9d87c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -308,8 +308,8 @@ fn prepare_input(
// Optionally truncate // Optionally truncate
let (inputs, input_length) = match truncate { let (inputs, input_length) = match truncate {
// Truncate is some and > encoding length // Truncate is some and < encoding length
Some(truncate) if truncate > encoding.len() => { Some(truncate) if truncate < encoding.len() => {
// truncate encoding and decode new inputs // truncate encoding and decode new inputs
encoding.truncate(truncate, 0, TruncationDirection::Left); encoding.truncate(truncate, 0, TruncationDirection::Left);
let inputs = tokenizer let inputs = tokenizer