mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 00:01:29 +00:00
FIX - bind FiveManage uploads by storage key
This commit is contained in:
@@ -92,7 +92,8 @@ describe('FiveManage server configuration contract', () => {
|
||||
expect(mediaServer).toContain(
|
||||
'path:find("/" .. state.upload_path .. "/", 1, true)',
|
||||
)
|
||||
expect(mediaServer).toContain('object_id ~= remote_id')
|
||||
expect(mediaServer).toContain('local storage_key = path:sub(2)')
|
||||
expect(mediaServer).toContain('}, nil, storage_key')
|
||||
expect(mediaServer).toContain('"HEAD"')
|
||||
expect(mediaServer).toContain(
|
||||
'SkyPhoneMediaImport.ResponseHeader(response.headers, "content-type")',
|
||||
|
||||
@@ -203,10 +203,11 @@ local function probe_uploaded_object(state, remote_id, uploaded_url)
|
||||
Bridge.Debug("error", "[sky_phone][media-debug] FiveManage upload URL is not bound to the server upload path.")
|
||||
return nil, "invalid_upload_token"
|
||||
end
|
||||
local filename = path:match("/([^/]+)$")
|
||||
local object_id = filename and filename:match("^([%w_%-]+)%.[%w]+$") or nil
|
||||
if object_id ~= remote_id then
|
||||
Bridge.Debug("error", "[sky_phone][media-debug] FiveManage upload URL does not contain the returned file ID.")
|
||||
local storage_key = path:sub(2)
|
||||
if #storage_key > 128 or storage_key:find("//", 1, true)
|
||||
or not storage_key:match("^[%w%._%-%/]+$")
|
||||
then
|
||||
Bridge.Debug("error", "[sky_phone][media-debug] FiveManage upload URL contains an invalid storage key.")
|
||||
return nil, "invalid_upload"
|
||||
end
|
||||
|
||||
@@ -255,7 +256,7 @@ local function probe_uploaded_object(state, remote_id, uploaded_url)
|
||||
size = size,
|
||||
type = mime_type,
|
||||
url = uploaded_url,
|
||||
}, nil, remote_id
|
||||
}, nil, storage_key
|
||||
end
|
||||
|
||||
local function get_remote_file(state, remote_id, uploaded_url)
|
||||
|
||||
Reference in New Issue
Block a user