提交 bf93eb47 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-5131 --resolve indeed, nice catch

上级 1b8ef184
...@@ -919,11 +919,19 @@ SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char clos ...@@ -919,11 +919,19 @@ SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char clos
static inline switch_bool_t switch_is_file_path(const char *file) static inline switch_bool_t switch_is_file_path(const char *file)
{ {
const char *e; const char *e;
int r; int r, x;
if (*file == '[' && *(file + 1) == *SWITCH_PATH_SEPARATOR) { for (x = 0; x < 2; x++) {
if ((e = switch_find_end_paren(file, '[', ']'))) { if (*file == '[' && *(file + 1) == *SWITCH_PATH_SEPARATOR) {
file = e + 1; if ((e = switch_find_end_paren(file, '[', ']'))) {
file = e + 1;
}
} else if (*file == '{') {
if ((e = switch_find_end_paren(file, '{', '}'))) {
file = e + 1;
}
} else {
break;
} }
} }
#ifdef WIN32 #ifdef WIN32
......
...@@ -1185,20 +1185,33 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1185,20 +1185,33 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
if (!strstr(file, SWITCH_URL_SEPARATOR)) { if (!strstr(file, SWITCH_URL_SEPARATOR)) {
if (!switch_is_file_path(file)) { if (!switch_is_file_path(file)) {
char *tfile = NULL; char *tfile = NULL, *tfile2 = NULL;
char *e; char *e;
int x;
if (*file == '[') {
tfile = switch_core_session_strdup(session, file); for (x = 0; x < 2; x++) {
if ((e = switch_find_end_paren(tfile, '[', ']'))) { if (*file == '[') {
*e = '\0'; tfile = switch_core_session_strdup(session, file);
file = e + 1; if ((e = switch_find_end_paren(tfile, '[', ']'))) {
*e = '\0';
file = e + 1;
} else {
tfile = NULL;
}
} else if (*file == '{') {
tfile2 = switch_core_session_strdup(session, file);
if ((e = switch_find_end_paren(tfile2, '{', '}'))) {
*e = '\0';
file = e + 1;
} else {
tfile2 = NULL;
}
} else { } else {
tfile = NULL; break;
} }
} }
file = switch_core_session_sprintf(session, "%s%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file); file = switch_core_session_sprintf(session, "%s%s%s%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", switch_str_nil(tfile2), tfile2 ? "}" : "", prefix, SWITCH_PATH_SEPARATOR, file);
} }
if ((ext = strrchr(file, '.'))) { if ((ext = strrchr(file, '.'))) {
ext++; ext++;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论