Skip to content

Commit

Permalink
Properly escape the Content-Disposition filename
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
hughsie committed Oct 25, 2023
1 parent 8c3e2a4 commit dfa124a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/passim-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,11 @@ passim_server_msg_send_item(PassimServer *self, SoupServerMessage *msg, PassimIt
{
SoupMessageHeaders *hdrs = soup_server_message_get_response_headers(msg);
g_autofree gchar *content_disposition = NULL;
g_autofree gchar *filename = NULL;
g_autofree gchar *path = g_file_get_path(passim_item_get_file(item));

content_disposition =
g_strdup_printf("attachment; filename=\"%s\"", passim_item_get_basename(item));
filename = g_uri_escape_string(passim_item_get_basename(item), NULL, TRUE);
content_disposition = g_strdup_printf("attachment; filename=\"%s\"", filename);
soup_message_headers_append(hdrs, "Content-Disposition", content_disposition);

passim_server_msg_send_file(self, msg, path);
Expand Down

0 comments on commit dfa124a

Please sign in to comment.