summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Sun <bins@vmware.com>2018-04-02 16:05:55 +0800
committerBin Sun <bins@vmware.com>2018-04-02 16:06:19 +0800
commit1c64622df18026119b9746631191cccc3dc56425 (patch)
treedbc58bb0f8923d07d85cee5cfde3001ec0283768
parent04c4fad51f0def942ac6db0f78efb7078d25afbb (diff)
Fix bug in image service
Change-Id: I61aa6946d00b1928203a51c33e284daa65c575a1 Issue-ID: MULTICLOUD-155 Signed-off-by: Bin Sun <bins@vmware.com>
-rw-r--r--vio/vio/swagger/views/image/views.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/vio/vio/swagger/views/image/views.py b/vio/vio/swagger/views/image/views.py
index a876529..9c6da70 100644
--- a/vio/vio/swagger/views/image/views.py
+++ b/vio/vio/swagger/views/image/views.py
@@ -170,12 +170,12 @@ class CreateImageFileView(APIView):
try:
image_file = request.FILES['file']
- random_name = ''.join(random.sample(
- string.ascii_letters
- + string.digits, 4))
- file_name = image_file.name[:image_file.name.rfind('.')]
- + "_" + random_name
- + image_file.name[image_file.name.find('.'):]
+ random_name = ''.join(
+ random.sample(string.ascii_letters + string.digits, 4))
+
+ file_name = image_file.name[:image_file.name.rfind('.')] + \
+ "_" + random_name + image_file.name[
+ image_file.name.find('.'):]
file_dest = sys.path[0] + '/images/' + file_name
with open(file_dest, 'wb+') as temp_file: