1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-04-28 03:20:10 +00:00

Add compat for Content-Disposition (#650)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks 2024-03-12 22:14:37 +08:00 committed by GitHub
parent b2bd7b7b6b
commit ef239b890d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);