fix: chat_msg media_dir path — strip filename from g_cc.db_path

g_cc.db_path is '/data/.../files/chats.db' (file path), but media blocks
are written to '/data/.../files/media/<channel>/'. chat_msg was concatenating
'chats.db/media/...' — now strips the database filename, using only the
directory portion for the media path.
This commit is contained in:
evgeny committed 2026-07-29 01:04:27 +03:00
1 parent b11e705f7a
commit 39d6f19d97
2 files changed
+15 -3

No files matched your search

@@ -85,6 +85,7 @@ int voice_recorder_init(const char* db_path) {
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "voice_recorder_init: db=%s preset=%d compressor=%d",
g_rec->db_path, g_rec->preset, g_rec->compressor_enabled);
debug_set_category_level(DEBUG_CATEGORY_GENERAL, DEBUG_LEVEL_INFO);
pthread_mutex_unlock(&g_init_mtx);
return 0;
}
@@ -339,8 +340,8 @@ int voice_recorder_stop(int* out_duration_ms) {
opus_codec_encoder_destroy(enc);
float duration_sec = (float)frame_count * FRAME_MS / 1000.0f;
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "voice_recorder_stop: %d frames (%.1fs) dur=%lldms compressor=%d",
frame_count, duration_sec, (long long)elapsed_ms, g_rec->compressor_enabled);
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "voice_recorder_stop: wrote %d frames (%.1fs) dur=%lldms compressor=%d path=%s",
frame_count, duration_sec, (long long)elapsed_ms, g_rec->compressor_enabled, temp_path);
if (frame_count <= 0) {
unlink(temp_path);
@@ -356,6 +357,8 @@ int voice_recorder_stop(int* out_duration_ms) {
uint32_t block_size = media_calc_block_size(file_size);
int num_blocks = (int)((file_size + block_size - 1) / block_size);
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "voice_recorder_stop: file_size=%llu block_size=%u num_blocks=%d",
(unsigned long long)file_size, block_size, num_blocks);
/* split file into blocks */
FILE* src = fopen(temp_path, "rb");