From 3cc3f6da3d6b0a29a9ed4926ba7d76f3972bf643 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 26 Feb 2018 20:51:42 -0800 Subject: [PATCH] modules/media/upload: Checkpoint rename to hash fwiw. --- modules/media/upload.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/media/upload.cc b/modules/media/upload.cc index 56375cd7a..2b53621d4 100644 --- a/modules/media/upload.cc +++ b/modules/media/upload.cc @@ -115,12 +115,20 @@ post__upload(client &client, char hashbuf[32]; hash.digest(hashbuf); - char uribuf[256], b58buf[64]; + char b58buf[64]; + const auto new_path + { + b58encode(b58buf, hashbuf) + }; + + fs::rename(path, new_path); + + char uribuf[256]; const string_view content_uri { fmt::sprintf { - uribuf, "mxc://%s/%s", my_host(), b58encode(b58buf, hashbuf) + uribuf, "mxc://%s/%s", my_host(), new_path } };