From 2d42fc01f98cb053918f8a1cc23975e08b902614 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 24 Mar 2004 00:03:38 +0000 Subject: [project @ 2004-03-24 00:03:38 by jmb] Improve handling of filename generation. svn path=/import/netsurf/; revision=658 --- content/fetch.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'content/fetch.c') diff --git a/content/fetch.c b/content/fetch.c index eda81d823..7be161c46 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -686,13 +686,23 @@ struct HttpPost *fetch_post_convert(struct form_successful_control *control) if (control->file) { mimetype = fetch_mimetype(control->value); #ifdef riscos - temp = strrchr(control->value, '.') + 1; - assert(temp); + temp = strrchr(control->value, '.'); + if (!temp) { + temp = control->value; /* already leafname */ + } + else { + temp += 1; + } leafname = xcalloc(strlen(temp), sizeof(char)); __unixify_std(temp, leafname, strlen(temp), 0xfff); #else - leafname = strrchr(control->value, '/') + 1; - assert(leafname); + leafname = strrchr(control->value, '/') ; + if (!leafname) { + leafname = control->value; + } + else { + leafname += 1; + } #endif curl_formadd(&post, &last, CURLFORM_COPYNAME, control->name, -- cgit v1.2.3