nextcloud
nextcloud copied to clipboard
How to delete a file?
It seems we can only delete a directory? If we upload a file at the same location, it does not upload it if the file is present, how to overwrite?
EDIT: It should be documented in the README that you can delete files as well.
encoded_location = URI::DEFAULT_PARSER.escape(location)
@nextcloud_service.webdav.directory.destroy(encoded_location)
And that you need to encode the location for uploads as well in order for the upload to work. And that you don't use the encoded location for the share_url method.
encoded_location = URI::DEFAULT_PARSER.escape(location)
@nextcloud_service.webdav.directory.upload(encoded_location, brand_file)
share_url = @nextcloud_service.ocs_fs.create(location, 3, nil, nil).share_url