fix(desktop): preserve formdata ordering (#4892)

This commit is contained in:
Shreyas 2025-03-19 14:04:13 +05:30 committed by GitHub
parent 5f3a7754d5
commit 60cc41f745
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 2001 additions and 1564 deletions

File diff suppressed because it is too large Load diff

View file

@ -188,7 +188,7 @@ checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
dependencies = [
"cfg-if",
"crossbeam-utils",
"hashbrown",
"hashbrown 0.14.5",
"lock_api",
"once_cell",
"parking_lot_core",
@ -238,6 +238,12 @@ dependencies = [
"log",
]
[[package]]
name = "equivalent"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "fnv"
version = "1.0.7"
@ -292,6 +298,12 @@ version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
[[package]]
name = "hashbrown"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
[[package]]
name = "heck"
version = "0.5.0"
@ -464,6 +476,17 @@ dependencies = [
"icu_properties",
]
[[package]]
name = "indexmap"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058"
dependencies = [
"equivalent",
"hashbrown 0.15.2",
"serde",
]
[[package]]
name = "infer"
version = "0.16.0"
@ -730,6 +753,7 @@ dependencies = [
"env_logger",
"http",
"http-serde",
"indexmap",
"infer",
"lazy_static",
"log",

View file

@ -30,3 +30,4 @@ strum = { version = "0.26.3", features = ["derive"] }
bytes = { version = "1.9.0", features = ["serde"] }
mime = "0.3.17"
url = "2.5.4"
indexmap = { version = "2.8.0", features = ["serde"] }

View file

@ -1,5 +1,6 @@
use curl::easy::Easy;
use http::HeaderName;
use indexmap::IndexMap;
use std::{collections::HashMap, path::Path};
use crate::{
@ -188,7 +189,7 @@ impl<'a> ContentHandler<'a> {
fn set_form_content(
&mut self,
content: &HashMap<String, Vec<FormValue>>,
content: &IndexMap<String, Vec<FormValue>>,
media_type: &MediaType,
) -> Result<()> {
let mut headers = HashMap::new();
@ -264,7 +265,7 @@ impl<'a> ContentHandler<'a> {
fn set_multipart_content(
&mut self,
content: &HashMap<String, Vec<FormValue>>,
content: &IndexMap<String, Vec<FormValue>>,
media_type: &MediaType,
) -> Result<()> {
self.set_form_content(content, media_type)

View file

@ -2,6 +2,7 @@ use std::collections::HashMap;
use bytes::Bytes;
use http::{Method, StatusCode, Version};
use indexmap::IndexMap;
use serde::{Deserialize, Serialize};
use strum::{Display, EnumString};
use time::OffsetDateTime;
@ -49,9 +50,7 @@ pub enum MediaType {
#[serde(tag = "kind", rename_all = "camelCase")]
pub enum FormValue {
#[serde(rename_all = "camelCase")]
Text {
value: String,
},
Text { value: String },
#[serde(rename_all = "camelCase")]
File {
filename: String,
@ -60,7 +59,7 @@ pub enum FormValue {
},
}
pub type FormData = HashMap<String, Vec<FormValue>>;
pub type FormData = IndexMap<String, Vec<FormValue>>;
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(tag = "kind", rename_all = "camelCase")]

File diff suppressed because it is too large Load diff

View file

@ -1949,7 +1949,7 @@ dependencies = [
"futures-core",
"futures-sink",
"http",
"indexmap 2.7.0",
"indexmap 2.8.0",
"slab",
"tokio",
"tokio-util",
@ -2398,9 +2398,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.7.0"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058"
dependencies = [
"equivalent",
"hashbrown 0.15.2",
@ -3580,7 +3580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016"
dependencies = [
"base64 0.22.1",
"indexmap 2.7.0",
"indexmap 2.8.0",
"quick-xml 0.32.0",
"serde",
"time",
@ -3956,7 +3956,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "relay"
version = "0.1.1"
source = "git+https://github.com/CuriousCorrelation/relay.git#b744a64c0e40829a44a562e51f9d18b4696d2ba4"
source = "git+https://github.com/CuriousCorrelation/relay.git#4b3869d63601a7cf671ccab09435402b91b42b0a"
dependencies = [
"bytes",
"curl",
@ -3964,6 +3964,7 @@ dependencies = [
"env_logger",
"http",
"http-serde",
"indexmap 2.8.0",
"infer",
"lazy_static",
"log",
@ -4385,7 +4386,7 @@ dependencies = [
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.7.0",
"indexmap 2.8.0",
"serde",
"serde_derive",
"serde_json",
@ -5081,7 +5082,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-relay"
version = "0.1.0"
source = "git+https://github.com/CuriousCorrelation/tauri-plugin-relay#124133dd126da3e0ed25ce578420c0ea2671e38e"
source = "git+https://github.com/CuriousCorrelation/tauri-plugin-relay#f4807290446e4bd3d33c9573578fec5a3b164091"
dependencies = [
"relay",
"serde",
@ -5511,7 +5512,7 @@ version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.7.0",
"indexmap 2.8.0",
"serde",
"serde_spanned",
"toml_datetime",
@ -5524,7 +5525,7 @@ version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
dependencies = [
"indexmap 2.7.0",
"indexmap 2.8.0",
"serde",
"serde_spanned",
"toml_datetime",
@ -6842,7 +6843,7 @@ dependencies = [
"displaydoc",
"flate2",
"hmac",
"indexmap 2.7.0",
"indexmap 2.8.0",
"lzma-rs",
"memchr",
"pbkdf2",

View file

@ -1180,7 +1180,7 @@ importers:
dependencies:
'@hoppscotch/plugin-relay':
specifier: github:CuriousCorrelation/tauri-plugin-relay
version: '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/124133dd126da3e0ed25ce578420c0ea2671e38e'
version: '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/f4807290446e4bd3d33c9573578fec5a3b164091'
'@tauri-apps/api':
specifier: 2.1.1
version: 2.1.1
@ -1809,8 +1809,8 @@ packages:
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1c2e8b19db7f1b6af6d00abb907f15cdc2017298}
version: 0.1.0
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/124133dd126da3e0ed25ce578420c0ea2671e38e':
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/124133dd126da3e0ed25ce578420c0ea2671e38e}
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/f4807290446e4bd3d33c9573578fec5a3b164091':
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/f4807290446e4bd3d33c9573578fec5a3b164091}
version: 0.1.0
'@alloc/quick-lru@5.2.0':
@ -13213,7 +13213,7 @@ snapshots:
dependencies:
'@tauri-apps/api': 2.1.1
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/124133dd126da3e0ed25ce578420c0ea2671e38e':
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/f4807290446e4bd3d33c9573578fec5a3b164091':
dependencies:
'@tauri-apps/api': 2.1.1