mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
38f09cbd16
commit
d2dfc922f3
1 changed files with 7 additions and 3 deletions
|
@ -30,7 +30,9 @@ void save_photos(struct membuffer *b, const char *photos_dir, struct dive *dive)
|
||||||
put_string(b, separator);
|
put_string(b, separator);
|
||||||
separator = ", ";
|
separator = ", ";
|
||||||
char *fname = get_file_name(local_file_path(pic));
|
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);
|
copy_image_and_overwrite(local_file_path(pic), photos_dir, fname);
|
||||||
free(fname);
|
free(fname);
|
||||||
pic = pic->next;
|
pic = pic->next;
|
||||||
|
@ -79,7 +81,9 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive)
|
||||||
do {
|
do {
|
||||||
put_string(b, separator);
|
put_string(b, separator);
|
||||||
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, "\"value\":\"%d\",", ev->value);
|
||||||
put_format(b, "\"type\":\"%d\",", ev->type);
|
put_format(b, "\"type\":\"%d\",", ev->type);
|
||||||
put_format(b, "\"time\":\"%d\"}", ev->time.seconds);
|
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;
|
found_sel_dive = 1;
|
||||||
put_format(b, "%c {", *sep);
|
put_format(b, "%c {", *sep);
|
||||||
(*sep) = ',';
|
(*sep) = ',';
|
||||||
put_format(b, "\"name\":\"%s\",", trip->location);
|
write_attribute(b, "name", trip->location, ", ");
|
||||||
put_format(b, "\"dives\":[");
|
put_format(b, "\"dives\":[");
|
||||||
}
|
}
|
||||||
put_string(b, separator);
|
put_string(b, separator);
|
||||||
|
|
Loading…
Reference in a new issue