From 0d8a600277fcadefb374a7d23857c522ce2b7a44 Mon Sep 17 00:00:00 2001 From: oldseven Date: Fri, 27 Apr 2018 15:17:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#1258=20bug=20fix:=20=E9=98=BF=E9=87=8C?= =?UTF-8?q?=E4=BA=91OSS=E5=BD=95=E5=83=8F=E6=97=A0=E6=B3=95=E5=9B=9E?= =?UTF-8?q?=E6=94=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/terminal/api.py b/apps/terminal/api.py index a964e9729..a5f7847ab 100644 --- a/apps/terminal/api.py +++ b/apps/terminal/api.py @@ -297,6 +297,10 @@ class SessionReplayViewSet(viewsets.ViewSet): date = self.session.date_start.strftime('%Y-%m-%d') file_path = os.path.join(date, str(self.session.id) + '.replay.gz') target_path = default_storage.base_location + '/' + path + folder_path = default_storage.base_location + date + + if not default_storage.exists(folder_path): + os.mkdir(folder_path) if client and client.has_file(file_path) and \ client.download_file(file_path, target_path): From 4f28f854103dec498440e960575305a29230acac Mon Sep 17 00:00:00 2001 From: oldseven Date: Tue, 29 May 2018 09:51:55 +0800 Subject: [PATCH 2/2] #1368 --- apps/terminal/api.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/terminal/api.py b/apps/terminal/api.py index fbbae5e22..28d8d6c02 100644 --- a/apps/terminal/api.py +++ b/apps/terminal/api.py @@ -4,6 +4,7 @@ from collections import OrderedDict import logging import os import uuid +import copy from django.core.cache import cache from django.shortcuts import get_object_or_404, redirect @@ -291,8 +292,12 @@ class SessionReplayViewSet(viewsets.ViewSet): url = default_storage.url(path) return redirect(url) else: - configs = settings.TERMINAL_REPLAY_STORAGE - configs = [cfg for cfg in configs if cfg['TYPE'] != 'server'] + config = settings.TERMINAL_REPLAY_STORAGE + configs = copy.deepcopy(config) + for cfg in config: + if config[cfg]['TYPE'] == 'server': + configs.__delitem__(cfg) + if not configs: return HttpResponseNotFound()