@@ -897,10 +897,13 @@ def push_file_to_central(self, filepath):
897897 def delete_file_from_central (self , filepath ):
898898 """Deletes a file in Qiita's central BASE_DATA_DIR directory.
899899
900- I currently (2025-09-25 ) assess this operation to be too dangerous for
900+ I currently (2025-11-12 ) assess this operation to be too dangerous for
901901 protocols other than "filesystem", i.e. on "https" the files are NOT
902902 deleted.
903- However, this might change in the future and since I don't want to
903+ However, in plugin tests, this function is needed and I therefore
904+ implemented an API endpoint which is only activated when Qiita main
905+ instance is operated in test mode.
906+ This might change in the future and since I don't want to
904907 touch every plugin's code again, I am adding this function here already
905908 and use it in according plugin code locations, e.g. function _gzip_file
906909 in qtp-sequencing.
@@ -916,8 +919,15 @@ def delete_file_from_central(self, filepath):
916919 The given filepath - to be transparent in plugin code.
917920 """
918921 if self ._plugincoupling == 'filesystem' :
919- os .remove (filepath )
922+ if os .path .isdir (filepath ):
923+ shutil .rmtree (filepath )
924+ else :
925+ os .remove (filepath )
920926 elif self ._plugincoupling == 'https' :
921- pass
927+ # will return in internal server error, when qiita is in productive
928+ # mode
929+ self .get (
930+ '/cloud/delete_file_from_central/' + filepath ,
931+ rettype = 'object' )
922932
923933 return filepath
0 commit comments