BOUNTY-9 (regression)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14897 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-09-16 22:56:30 +00:00
parent bf5e4c30e9
commit 67823be168
1 changed files with 28 additions and 22 deletions

View File

@ -67,10 +67,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
switch_set_flag(fh, SWITCH_FILE_FLAG_FREE_POOL); switch_set_flag(fh, SWITCH_FILE_FLAG_FREE_POOL);
} }
fh->file_path = switch_core_strdup(fh->memory_pool, file_path);
if ((rhs = strstr(file_path, SWITCH_URL_SEPARATOR))) {
switch_copy_string(stream_name, file_path, (rhs + 1) - file_path);
ext = stream_name;
file_path = rhs + 3;
fh->file_path = switch_core_strdup(fh->memory_pool, file_path);
} else {
if ((flags & SWITCH_FILE_FLAG_WRITE)) { if ((flags & SWITCH_FILE_FLAG_WRITE)) {
char *p = fh->file_path, *e;
char *p, *e;
fh->file_path = switch_core_strdup(fh->memory_pool, file_path);
p = fh->file_path;
if (*p == '[' && *(p + 1) == *SWITCH_PATH_SEPARATOR) { if (*p == '[' && *(p + 1) == *SWITCH_PATH_SEPARATOR) {
e = switch_find_end_paren(p, '[', ']'); e = switch_find_end_paren(p, '[', ']');
@ -87,21 +96,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
} }
file_path = fh->file_path; file_path = fh->file_path;
} }
if ((rhs = strstr(file_path, SWITCH_URL_SEPARATOR))) {
switch_copy_string(stream_name, file_path, (rhs + 1) - file_path);
ext = stream_name;
file_path = rhs + 3;
} else {
if ((ext = strrchr(file_path, '.')) == 0) { if ((ext = strrchr(file_path, '.')) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown file Format [%s]\n", file_path); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown file Format [%s]\n", file_path);
switch_goto_status(SWITCH_STATUS_FALSE, end); switch_goto_status(SWITCH_STATUS_FALSE, end);
} }
ext++; ext++;
fh->file_path = switch_core_strdup(fh->memory_pool, file_path);
} }
if ((fh->file_interface = switch_loadable_module_get_file_interface(ext)) == 0) { if ((fh->file_interface = switch_loadable_module_get_file_interface(ext)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid file format [%s] for [%s]!\n", ext, file_path); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid file format [%s] for [%s]!\n", ext, file_path);
switch_goto_status(SWITCH_STATUS_GENERR, end); switch_goto_status(SWITCH_STATUS_GENERR, end);