From 2c2107f0ba8272d892fb714a8c76fcf52de6b420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=B5=AB=E7=84=B6?= Date: Wed, 6 Mar 2024 15:27:29 +0800 Subject: [PATCH] Add compat for Content-Disposition --- server/upload-file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/upload-file.c b/server/upload-file.c index c860fb35..b3445f6a 100755 --- a/server/upload-file.c +++ b/server/upload-file.c @@ -1812,7 +1812,11 @@ get_mime_header_param_value (const char *param) char *first_quote, *last_quote; char *value; + // param may not start with double quotes. first_quote = strchr (param, '\"'); + if (!first_quote) { + return g_strdup (param); + } last_quote = strrchr (param, '\"'); if (!first_quote || !last_quote || first_quote == last_quote) { seaf_debug ("[upload] Invalid mime param %s.\n", param); @@ -1869,7 +1873,8 @@ parse_mime_header (evhtp_request_t *req, char *header, RecvFSM *fsm) } *colon = 0; - if (strcmp (header, "Content-Disposition") == 0) { + // Content-Disposition is case-insensitive. + if (strcasecmp (header, "Content-Disposition") == 0) { params = g_strsplit (colon + 1, ";", 3); for (p = params; *p != NULL; ++p) *p = g_strstrip (*p);