@@ -18,7 +18,8 @@ def save(self, model, path=""):
18
18
if chunk is not None :
19
19
path = path .strip ("/" )
20
20
21
- self .run_pre_save_hook (model = model , path = path )
21
+ if chunk == 1 :
22
+ self .run_pre_save_hook (model = model , path = path )
22
23
23
24
if "type" not in model :
24
25
raise web .HTTPError (400 , "No file type provided" )
@@ -31,7 +32,10 @@ def save(self, model, path=""):
31
32
raise web .HTTPError (400 , "No file content provided" )
32
33
33
34
os_path = self ._get_os_path (path )
34
- self .log .debug ("Saving %s" , os_path )
35
+ if chunk == - 1 :
36
+ self .log .debug (f"Saving last chunk of file { os_path } " )
37
+ else :
38
+ self .log .debug (f"Saving chunk { chunk } of file { os_path } " )
35
39
36
40
try :
37
41
if chunk == 1 :
@@ -89,9 +93,8 @@ async def save(self, model, path=""):
89
93
if chunk is not None :
90
94
path = path .strip ("/" )
91
95
92
- os_path = self ._get_os_path (path )
93
- self .log .debug ("Saving %s" , os_path )
94
- self .run_pre_save_hook (model = model , path = path )
96
+ if chunk == 1 :
97
+ self .run_pre_save_hook (model = model , path = path )
95
98
96
99
if "type" not in model :
97
100
raise web .HTTPError (400 , "No file type provided" )
@@ -103,6 +106,12 @@ async def save(self, model, path=""):
103
106
if "content" not in model and model ["type" ] != "directory" :
104
107
raise web .HTTPError (400 , "No file content provided" )
105
108
109
+ os_path = self ._get_os_path (path )
110
+ if chunk == - 1 :
111
+ self .log .debug (f"Saving last chunk of file { os_path } " )
112
+ else :
113
+ self .log .debug (f"Saving chunk { chunk } of file { os_path } " )
114
+
106
115
try :
107
116
if chunk == 1 :
108
117
await super (AsyncLargeFileManager , self )._save_file (
0 commit comments