@@ -226,38 +226,37 @@ def config_string(self, name: str) -> str:
226226 if not self .configuration :
227227 raise ValidationError ("Missing configuration for cloud storage" )
228228 # TODO Use RCloneValidator.get_real_configuration(...) instead.
229- real_config = dict (self .configuration )
230229 # Transform configuration for polybox, switchDrive or openBIS
231230 storage_type = self .configuration .get ("type" , "" )
232231 access = self .configuration .get ("provider" , "" )
233232
234233 if storage_type == "polybox" or storage_type == "switchDrive" :
235- real_config ["type" ] = "webdav"
236- real_config ["provider" ] = ""
234+ self . configuration ["type" ] = "webdav"
235+ self . configuration ["provider" ] = ""
237236 elif storage_type == "s3" and access == "Switch" :
238237 # Switch is a fake provider we add for users, we need to replace it since rclone itself
239238 # doesn't know it
240- real_config ["provider" ] = "Other"
239+ self . configuration ["provider" ] = "Other"
241240 elif storage_type == "openbis" :
242- real_config ["type" ] = "sftp"
243- real_config ["port" ] = "2222"
244- real_config ["user" ] = "?"
245- real_config ["pass" ] = real_config . pop ("session_token" )
241+ self . configuration ["type" ] = "sftp"
242+ self . configuration ["port" ] = "2222"
243+ self . configuration ["user" ] = "?"
244+ self . configuration ["pass" ] = self . configuration . pop ("session_token" , self . configuration [ "pass" ] )
246245
247246 if access == "shared" and storage_type == "polybox" :
248- real_config ["url" ] = "https://polybox.ethz.ch/public.php/webdav/"
247+ self . configuration ["url" ] = "https://polybox.ethz.ch/public.php/webdav/"
249248 elif access == "shared" and storage_type == "switchDrive" :
250- real_config ["url" ] = "https://drive.switch.ch/public.php/webdav/"
249+ self . configuration ["url" ] = "https://drive.switch.ch/public.php/webdav/"
251250 elif access == "personal" and storage_type == "polybox" :
252- real_config ["url" ] = "https://polybox.ethz.ch/remote.php/webdav/"
251+ self . configuration ["url" ] = "https://polybox.ethz.ch/remote.php/webdav/"
253252 elif access == "personal" and storage_type == "switchDrive" :
254- real_config ["url" ] = "https://drive.switch.ch/remote.php/webdav/"
253+ self . configuration ["url" ] = "https://drive.switch.ch/remote.php/webdav/"
255254
256255 # Extract the user from the public link
257256 if access == "shared" and storage_type in {"polybox" , "switchDrive" }:
258257 public_link = self .configuration .get ("public_link" , "" )
259258 user_identifier = public_link .split ("/" )[- 1 ]
260- real_config ["user" ] = user_identifier
259+ self . configuration ["user" ] = user_identifier
261260
262261 parser = ConfigParser ()
263262 parser .add_section (name )
@@ -267,7 +266,7 @@ def _stringify(value: Any) -> str:
267266 return "true" if value else "false"
268267 return str (value )
269268
270- for k , v in real_config .items ():
269+ for k , v in self . configuration .items ():
271270 parser .set (name , k , _stringify (v ))
272271 stringio = StringIO ()
273272 parser .write (stringio )
0 commit comments