FS-5131 --resolve indeed, nice catch
This commit is contained in:
parent
1b8ef1842e
commit
bf93eb47e9
|
@ -919,12 +919,20 @@ 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)
|
||||
{
|
||||
const char *e;
|
||||
int r;
|
||||
int r, x;
|
||||
|
||||
for (x = 0; x < 2; x++) {
|
||||
if (*file == '[' && *(file + 1) == *SWITCH_PATH_SEPARATOR) {
|
||||
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
|
||||
r = (file && (*file == '\\' || *(file + 1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR)));
|
||||
|
|
|
@ -1185,9 +1185,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||
|
||||
if (!strstr(file, SWITCH_URL_SEPARATOR)) {
|
||||
if (!switch_is_file_path(file)) {
|
||||
char *tfile = NULL;
|
||||
char *tfile = NULL, *tfile2 = NULL;
|
||||
char *e;
|
||||
int x;
|
||||
|
||||
for (x = 0; x < 2; x++) {
|
||||
if (*file == '[') {
|
||||
tfile = switch_core_session_strdup(session, file);
|
||||
if ((e = switch_find_end_paren(tfile, '[', ']'))) {
|
||||
|
@ -1196,9 +1198,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||
} 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 {
|
||||
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, '.'))) {
|
||||
ext++;
|
||||
|
|
Loading…
Reference in New Issue