File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 9292from .errors import StorageLimitHit , ProjectLocked
9393from ..utils import format_time_delta
9494
95+ EXCLUDED_CLONE_FILENAMES = {
96+ "qgis_cfg.xml" ,
97+ }
98+
9599
96100def parse_project_access_update_request (access : Dict ) -> Dict :
97101 """Parse raw project access update request and filter out invalid entries.
@@ -1138,7 +1142,9 @@ def clone_project(namespace, project_name): # noqa: E501
11381142 db .session .add (p )
11391143
11401144 try :
1141- p .storage .initialize (template_project = cloned_project )
1145+ p .storage .initialize (
1146+ template_project = cloned_project , excluded_files = EXCLUDED_CLONE_FILENAMES
1147+ )
11421148 except InitializationError as e :
11431149 abort (400 , f"Failed to clone project: { str (e )} " )
11441150
@@ -1149,6 +1155,8 @@ def clone_project(namespace, project_name): # noqa: E501
11491155 # transform source files to new uploaded files
11501156 file_changes = []
11511157 for file in cloned_project .files :
1158+ if os .path .basename (file .path ) in EXCLUDED_CLONE_FILENAMES :
1159+ continue
11521160 file_changes .append (
11531161 ProjectFileChange (
11541162 file .path ,
Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ def _project_dir(self):
178178 )
179179 return project_dir
180180
181- def initialize (self , template_project = None ):
181+ def initialize (self , template_project = None , excluded_files = None ):
182182 if os .path .exists (self .project_dir ):
183183 raise InitializationError (
184184 "Project directory already exists: {}" .format (self .project_dir )
@@ -193,8 +193,12 @@ def initialize(self, template_project=None):
193193 if ws .disk_usage () + template_project .disk_usage > ws .storage :
194194 self .delete ()
195195 raise InitializationError ("Disk quota reached" )
196+ if excluded_files is None :
197+ excluded_files = set ()
196198
197199 for file in template_project .files :
200+ if os .path .basename (file .path ) in excluded_files :
201+ continue
198202 src = os .path .join (template_project .storage .project_dir , file .location )
199203 dest = os .path .join (
200204 self .project_dir ,
You can’t perform that action at this time.
0 commit comments