diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-08-23 03:05:32 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-23 05:01:32 -0700 |
commit | d2dfc922f311a9ae095dbaef448ed283fe8ded8d (patch) | |
tree | eb9ff0fa4cea7202ce999f2868094b47a14f25cc /core | |
parent | 38f09cbd1641b2fee45fe8593c8fb0ef1efeb50a (diff) | |
download | subsurface-d2dfc922f311a9ae095dbaef448ed283fe8ded8d.tar.gz |
save-html: make sure that some strings are quoted
- filenames for pictures
- trip locations
- event names (not really needed)
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/save-html.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/save-html.c b/core/save-html.c index 2081b2eab..38f48e8c4 100644 --- a/core/save-html.c +++ b/core/save-html.c @@ -30,7 +30,9 @@ void save_photos(struct membuffer *b, const char *photos_dir, struct dive *dive) put_string(b, separator); separator = ", "; char *fname = get_file_name(local_file_path(pic)); - put_format(b, "{\"filename\":\"%s\"}", fname); + put_string(b, "{\"filename\":\""); + put_quoted(b, fname, 1, 0); + put_string(b, "\"}"); copy_image_and_overwrite(local_file_path(pic), photos_dir, fname); free(fname); pic = pic->next; @@ -79,7 +81,9 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive) do { put_string(b, separator); separator = ", "; - put_format(b, "{\"name\":\"%s\",", ev->name); + put_string(b, "{\"name\":\""); + put_quoted(b, ev->name, 1, 0); + put_string(b, "\","); put_format(b, "\"value\":\"%d\",", ev->value); put_format(b, "\"type\":\"%d\",", ev->type); put_format(b, "\"time\":\"%d\"}", ev->time.seconds); @@ -413,7 +417,7 @@ void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no, bool selec found_sel_dive = 1; put_format(b, "%c {", *sep); (*sep) = ','; - put_format(b, "\"name\":\"%s\",", trip->location); + write_attribute(b, "name", trip->location, ", "); put_format(b, "\"dives\":["); } put_string(b, separator); |