Hi, as you can see, in vd_agent/file_xfer.cpp, it implemented the g_key_get_string,
but I find a problem, when dragging a file with a name containing '[' (like te[st.txt), it will be failed.
>From source code,
>next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
> if (next_group_pos && key_pos > next_group_pos) return false;
we know that it tries to find the end of current group by '[' label,
if we drag a file like te[st.txt, the key_string many like:
[vdagent-file-xfer]
name=te[st.txt
size=10
so, it's failed when meta parsing and returns VD_AGENT_FILE_XFER_STATUS_ERRO message.
I find a way to fix it, just replace '[' ']' with '<' '>' between group name,
for it's illegal for windows to create a file with a name containing '<'/'>'.
And of course, both vd_agent and spice-gtk should be patched.
---
vdagent/file_xfer.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index e402eb2..6998901 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -188,13 +188,13 @@ bool FileXfer::g_key_get_string(char* data, const char* group, const char* key,
char *group_pos, *key_pos, *next_group_pos, *start, *end;
unsigned len;
- snprintf(group_pfx, sizeof(group_pfx), "[%s]", group);
+ snprintf(group_pfx, sizeof(group_pfx), "<%s>", group);
if (!(group_pos = strstr((char*)data, group_pfx))) return false;
snprintf(key_pfx, sizeof(key_pfx), "\n%s=", key);
if (!(key_pos = strstr(group_pos, key_pfx))) return false;
- next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
+ next_group_pos = strstr(group_pos + strlen(group_pfx), "<");
if (next_group_pos && key_pos > next_group_pos) return false;
start = key_pos + strlen(key_pfx);
--
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel