mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-22 23:31:05 +00:00
Changelog and fix payload size limit to be per mime type
This commit is contained in:
parent
ae5f84ee65
commit
184065085c
2 changed files with 8 additions and 6 deletions
|
|
@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
|
|||
- Show file icons in trash/delete/overwrite confirmations ([#4096])
|
||||
- Dynamic keymap Lua API ([#4031])
|
||||
- New `ui.Input` element ([#4040])
|
||||
- Copying and pasting files with the system clipboard ([#4035])
|
||||
- Image preview with Überzug++ on Niri ([#3990])
|
||||
- New gait for input `backward` and `forward` actions ([#4012])
|
||||
|
||||
|
|
@ -1768,6 +1769,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
|
|||
[#4012]: https://github.com/sxyazi/yazi/pull/4012
|
||||
[#4022]: https://github.com/sxyazi/yazi/pull/4022
|
||||
[#4031]: https://github.com/sxyazi/yazi/pull/4031
|
||||
[#4035]: https://github.com/sxyazi/yazi/pull/4035
|
||||
[#4040]: https://github.com/sxyazi/yazi/pull/4040
|
||||
[#4064]: https://github.com/sxyazi/yazi/pull/4064
|
||||
[#4065]: https://github.com/sxyazi/yazi/pull/4065
|
||||
|
|
|
|||
|
|
@ -90,18 +90,18 @@ impl Parser {
|
|||
// decode now since each payload may have its own padding
|
||||
let payload = BASE64_PAD.decode(&payload).or(Err(ParseError::Invalid))?;
|
||||
|
||||
// Limit payload size to 1MiB to prevent potential DoS
|
||||
// TODO A larger size would be required for directly pasting images/large files
|
||||
if state.payload.len() + payload.len() > 1 << 20 {
|
||||
return Err(ParseError::Invalid);
|
||||
}
|
||||
|
||||
if state.idx >= state.payload.len() {
|
||||
state.payload.push(payload.to_vec());
|
||||
} else {
|
||||
state.payload[state.idx].extend(payload);
|
||||
}
|
||||
|
||||
// Limit payload size to 1MiB per mime type to prevent potential DoS
|
||||
// TODO A larger size would be required for directly pasting images/large files
|
||||
if state.payload[state.idx].len() > 1 << 20 {
|
||||
return Err(ParseError::Invalid);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue