comparison mod_muc_cache_media/mod_muc_cache_media.lua @ 6418:98e06fc5680f

mod_muc_cache_media: relative link is better
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Tue, 24 Feb 2026 13:20:45 -0500
parents dcc8d4af8d4f
children 233691533318
comparison
equal deleted inserted replaced
6417:dcc8d4af8d4f 6418:98e06fc5680f
150 lfs.touch(final_path) 150 lfs.touch(final_path)
151 os.remove(tmp_path) 151 os.remove(tmp_path)
152 end 152 end
153 local sha2_path = storage_path.."/sha-256/"..sha2:gsub("+","-"):gsub("/","_"):gsub("=","") 153 local sha2_path = storage_path.."/sha-256/"..sha2:gsub("+","-"):gsub("/","_"):gsub("=","")
154 if not lfs.attributes(sha2_path) then 154 if not lfs.attributes(sha2_path) then
155 lfs.link(final_path, sha2_path, true) 155 lfs.link("../"..final_name, sha2_path, true)
156 end 156 end
157 url_map[original_url] = { local_url = public_base_url..final_name.."?ct="..content_type, path=final_path, sha2=sha2, sha3=sha3, size=size, name=name, content_type=content_type } 157 url_map[original_url] = { local_url = public_base_url..final_name.."?ct="..content_type, path=final_path, sha2=sha2, sha3=sha3, size=size, name=name, content_type=content_type }
158 else 158 else
159 os.remove(tmp_path) 159 os.remove(tmp_path)
160 end 160 end