diff --git a/aleksis/core/tests/util/test_core_helpers.py b/aleksis/core/tests/util/test_core_helpers.py
new file mode 100644
index 0000000000000000000000000000000000000000..d018ddba3b610251aafcf47698f7669c49ef8fef
--- /dev/null
+++ b/aleksis/core/tests/util/test_core_helpers.py
@@ -0,0 +1,19 @@
+import re
+
+from aleksis.core.util.core_helpers import path_and_rename
+
+
+def test_path_and_rename():
+    re_base = r"[a-z0-9]+"
+
+    example_1 = "sdjaasjkl.jpg"
+    re_example_1 = "files/" + re_base + r"\.jpg"
+    re2_example_1 = "images/" + re_base + r"\.jpg"
+    assert re.match(re_example_1, path_and_rename(None, example_1))
+    assert re.match(re2_example_1, path_and_rename(None, example_1, upload_to="images"))
+
+    example_2 = "sdjaasjkl"
+    re_example_2 = "files/" + re_base
+    re2_example_2 = "images/" + re_base
+    assert re.match(re_example_2, path_and_rename(None, example_2))
+    assert re.match(re2_example_2, path_and_rename(None, example_2, upload_to="images"))
diff --git a/aleksis/core/util/core_helpers.py b/aleksis/core/util/core_helpers.py
index ba28f66292217b77a8d15eb1988774bbe09776fb..29711935cf420f1af690aeae6a13c1bcc49f97b5 100644
--- a/aleksis/core/util/core_helpers.py
+++ b/aleksis/core/util/core_helpers.py
@@ -308,7 +308,7 @@ def path_and_rename(instance, filename: str, upload_to: str = "files") -> str:
     _, ext = os.path.splitext(filename)
 
     # set filename as random string
-    new_filename = f"{uuid4().hex}.{ext}"
+    new_filename = f"{uuid4().hex}{ext}"
 
     # Create upload directory if necessary
     os.makedirs(os.path.join(settings.MEDIA_ROOT, upload_to), exist_ok=True)