Skip to content

Commit b3f7777

Browse files
committed
Fix empty object in profile not exported
1 parent 935688e commit b3f7777

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

ytflow-app-util/src/profile/export.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn encode_cbor_buf(buf: &[u8]) -> TomlValue {
7474
CborValue::Text(s) => s == "__byte_repr" || s == "__toml_repr",
7575
_ => false,
7676
});
77-
table.set_dotted(!(is_repr || indent > 2));
77+
table.set_dotted(!(is_repr || indent > 2 || table.is_empty()));
7878
TomlValue::InlineTable(table)
7979
}
8080
_ => return None,
@@ -255,6 +255,20 @@ mod tests {
255255
&db,
256256
)
257257
.unwrap();
258+
Plugin::create(
259+
profile_id,
260+
"ws-client".into(),
261+
"WebSocket client.".into(),
262+
"ws-client".into(),
263+
0,
264+
to_cbor(cbor!({
265+
"headers" => {},
266+
"next" => "client-tls.tcp"
267+
}))
268+
.to_vec(),
269+
&db,
270+
)
271+
.unwrap();
258272
Plugin::create(
259273
profile_id,
260274
"null".into(),
@@ -336,6 +350,14 @@ param.fallback.udp = "proxy-forward.udp"
336350
param.fallback.resolver = "fake-ip.resolver"
337351
updated_at = 2024-04-27T09:43:17.191
338352
353+
# WebSocket client.
354+
[plugins.ws-client]
355+
plugin = "ws-client"
356+
plugin_version = 0
357+
param.headers = {}
358+
param.next = "client-tls.tcp"
359+
updated_at = 2024-04-27T09:43:17.191
360+
339361
# null
340362
[plugins.null]
341363
plugin = "null"

0 commit comments

Comments
 (0)