FIX - bind FiveManage uploads by storage key

This commit is contained in:
Leon.Schmidt
2026-08-21 00:35:18 +02:00
parent 9574c0ca58
commit 37948e1f6d
2 changed files with 8 additions and 6 deletions
@@ -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")',
+6 -5
View File
@@ -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)