Users are no longer able to delete root folder.
authorFuad Muhic <fmuhic@capeannenterprises.com>
Wed, 20 Dec 2017 09:24:27 +0000 (10:24 +0100)
committerFuad Muhic <fmuhic@capeannenterprises.com>
Wed, 20 Dec 2017 09:24:27 +0000 (10:24 +0100)
Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic@capeannenterprises.com>

sdk/R/R/Subcollection.R

index 78cc4c13bf82646f6136920b77fb4c2b00e52c5e..a1fba1a4adf912f896fedbf26f152ca6b9ee269c 100644 (file)
@@ -45,16 +45,17 @@ Subcollection <- R6::R6Class(
             if(is.null(private$collection))
                 stop("Subcollection doesn't belong to any collection.")
 
+            if(self$name == "")
+                stop("Unable to delete root folder.")
+
             collectionList <- paste0(self$getRelativePath(), "/", self$getFileList(fullpath = FALSE))
             sapply(collectionList, function(file)
             {
                 private$collection$.__enclos_env__$private$deleteFromREST(file)
             })
 
-            #todo rename this add to a collection
             private$addToCollection(NULL)
             private$dettachFromParent()
-
         },
 
         getFileList = function(fullpath = TRUE)