Software /
code /
prosody-modules
Changeset
4470:203f0f06d766
mod_migrate_http_upload: Respect the 'http_upload_path' setting
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 24 Feb 2021 18:12:12 +0100 |
parents | 4469:6844733ad2f5 |
children | 4471:af7a9856950d |
files | mod_migrate_http_upload/mod_migrate_http_upload.lua |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_migrate_http_upload/mod_migrate_http_upload.lua Wed Feb 24 16:57:28 2021 +0100 +++ b/mod_migrate_http_upload/mod_migrate_http_upload.lua Wed Feb 24 18:12:12 2021 +0100 @@ -18,6 +18,8 @@ local new_uploads = sm.open(component, "uploads", "archive"); + local legacy_storage_path = module:context(component):get_option_string("http_upload_path", paths.join(prosody.paths.data, "http_upload")); + local legacy_uploads = {}; for user in assert(dm.users(user_host, "http_upload", "list")) do legacy_uploads[user] = dm.list_load(user, user_host, "http_upload"); @@ -31,8 +33,8 @@ end if not oldest_uploads then break end local item = table.remove(oldest_uploads, 1); - local source_directory = paths.join(prosody.paths.data, "http_upload", item.dir); - local source_filename = paths.join(prosody.paths.data, "http_upload", item.dir, item.filename); + local source_directory = paths.join(legacy_storage_path, item.dir); + local source_filename = paths.join(source_directory, item.dir, item.filename); local target_filename = dm.getpath(item.dir, component, "http_file_share", "bin", true); if not lfs.attributes(source_filename, "mode") then print("Not migrating missing file " .. source_filename);