Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI: dvrfile - convert back the subscription file id to utf8
  • Loading branch information
perexg committed Oct 20, 2015
1 parent bc4d16c commit 2d996fc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/webui/webui.c
Expand Up @@ -1468,7 +1468,7 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque)
struct stat st;
const char *content = NULL, *range, *filename;
dvr_entry_t *de;
char *fname;
char *fname, *charset;
char *basename;
char *str, *str0;
char range_buf[255];
Expand Down Expand Up @@ -1510,6 +1510,7 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque)

fname = tvh_strdupa(filename);
content = muxer_container_type2mime(de->de_mc, 1);
charset = de->de_config ? de->de_config->dvr_charset_id : NULL;

pthread_mutex_unlock(&global_lock);

Expand Down Expand Up @@ -1585,10 +1586,17 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque)
http_stream_postop(tcp_id);
tcp_id = NULL;
} else {
basename = malloc(strlen(fname) + 7 + 1);
str = intlconv_to_utf8safestr(charset, fname, strlen(fname) * 3);
if (str == NULL)
str = intlconv_to_utf8safestr(intlconv_charset_id("ASCII", 1, 1),
fname, strlen(fname) * 3);
if (str == NULL)
str = strdup("error");
basename = malloc(strlen(str) + 7 + 1);
strcpy(basename, "file://");
strcat(basename, fname);
strcat(basename, str);
sub->ths_dvrfile = basename;
free(str);
}
}
pthread_mutex_unlock(&global_lock);
Expand Down

0 comments on commit 2d996fc

Please sign in to comment.