From 981f749b2ce2e6557a57f3c248b008f0aac2b5eb Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Sun, 12 Feb 2017 17:08:14 +0100
Subject: [PATCH] Use shutil instead of os.rename

---
 funkwhale_api/common/utils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/funkwhale_api/common/utils.py b/funkwhale_api/common/utils.py
index ea531d6..66fa8e8 100644
--- a/funkwhale_api/common/utils.py
+++ b/funkwhale_api/common/utils.py
@@ -1,4 +1,5 @@
 import os
+import shutil
 
 
 def rename_file(instance, field_name, new_name, allow_missing_file=False):
@@ -7,7 +8,7 @@ def rename_file(instance, field_name, new_name, allow_missing_file=False):
 
     new_name_with_extension = '{}{}'.format(new_name, extension)
     try:
-        os.rename(field.path, new_name_with_extension)
+        shutil.move(field.path, new_name_with_extension)
     except FileNotFoundError:
         if not allow_missing_file:
             raise
-- 
GitLab