diff --git a/src/piler.h b/src/piler.h index e41e2334..973c5ca3 100644 --- a/src/piler.h +++ b/src/piler.h @@ -54,6 +54,7 @@ void check_and_create_directories(struct config *cfg, uid_t uid, gid_t gid); void update_counters(struct session_data *sdata, struct data *data, struct counters *counters, struct config *cfg); int retrieve_email_from_archive(struct session_data *sdata, FILE *dest, struct config *cfg); +void assemble_attachment_filename(char *filename, int len, char *s, int attachment_id, struct config *cfg); int file_from_archive_to_network(char *filename, int sd, int tls_enable, struct data *data, struct config *cfg); int get_folder_id(struct session_data *sdata, char *foldername, int parent_id); diff --git a/src/pileraget.c b/src/pileraget.c index 3b780cc5..1ced2df4 100644 --- a/src/pileraget.c +++ b/src/pileraget.c @@ -46,13 +46,8 @@ int main(int argc, char **argv){ return 1; } - snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c%c/%c%c/%c%c/%s.a%d", cfg.queuedir, cfg.server_id, argv[1][8], argv[1][9], argv[1][10], argv[1][RND_STR_LEN-4], argv[1][RND_STR_LEN-3], argv[1][RND_STR_LEN-2], argv[1][RND_STR_LEN-1], argv[1], atoi(argv[2])); -#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT - if(stat(filename, &st)){ - snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c/%c%c/%c%c/%s.a%d", cfg.queuedir, cfg.server_id, argv[1][RND_STR_LEN-6], argv[1][RND_STR_LEN-5], argv[1][RND_STR_LEN-4], argv[1][RND_STR_LEN-3], argv[1][RND_STR_LEN-2], argv[1][RND_STR_LEN-1], argv[1], atoi(argv[2])); - } -#endif + assemble_attachment_filename(filename, sizeof(filename), argv[1], atoi(argv[2]), &cfg); retrieve_file_from_archive(filename, WRITE_TO_STDOUT, NULL, stdout, &cfg); return 0;