Fix the find_file function when so it works with base64
This commit is contained in:
@@ -6,6 +6,7 @@ local basename = require "resources.functions.basename"
|
|||||||
local is_absolute_path = require "resources.functions.is_absolute_path"
|
local is_absolute_path = require "resources.functions.is_absolute_path"
|
||||||
|
|
||||||
function find_file(dbh, domain_name, domain_uuid, file_name)
|
function find_file(dbh, domain_name, domain_uuid, file_name)
|
||||||
|
|
||||||
-- if we specify e.g. full path
|
-- if we specify e.g. full path
|
||||||
if (is_absolute_path(file_name) and file.exists(file_name)) then
|
if (is_absolute_path(file_name) and file.exists(file_name)) then
|
||||||
log.debugf('[find_file.lua] found file `%s` in file system', file_name)
|
log.debugf('[find_file.lua] found file `%s` in file system', file_name)
|
||||||
@@ -28,8 +29,17 @@ function find_file(dbh, domain_name, domain_uuid, file_name)
|
|||||||
local settings = Settings.new(dbh, domain_name, domain_uuid)
|
local settings = Settings.new(dbh, domain_name, domain_uuid)
|
||||||
local storage_type = settings:get('recordings', 'storage_type', 'text') or ''
|
local storage_type = settings:get('recordings', 'storage_type', 'text') or ''
|
||||||
if storage_type == 'base64' then
|
if storage_type == 'base64' then
|
||||||
|
--create the database object
|
||||||
|
local Database = require "resources.functions.database"
|
||||||
|
|
||||||
|
-- json need to add when enabling debug sql
|
||||||
|
local json
|
||||||
|
if (debug["sql"]) then
|
||||||
|
json = require "resources.functions.lunajson"
|
||||||
|
end
|
||||||
|
|
||||||
local sql = "SELECT recording_base64 FROM v_recordings "
|
local sql = "SELECT recording_base64 FROM v_recordings "
|
||||||
.. "WHERE domain_uuid = :domain_uuid"
|
.. "WHERE domain_uuid = :domain_uuid "
|
||||||
.. "AND recording_filename = :file_name "
|
.. "AND recording_filename = :file_name "
|
||||||
local params = {domain_uuid = domain_uuid, file_name = file_name};
|
local params = {domain_uuid = domain_uuid, file_name = file_name};
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
|
|||||||
Reference in New Issue
Block a user