If data provider indicated at upload does not exist (any more), CBRAIN yield exception leading to 500 Internal Server Error, while 404 Not Found is more appropriate. Or, perhaps, default provider should be used instead.
NoMethodError (undefined method `content_storage_shared_between_users?' for nil:NilClass):
app/models/userfile.rb:1141:in `flat_dir_dp_name_uniqueness'
app/controllers/userfiles_controller.rb:560:in `create'
I think using safe navigation with that method would be enough