deleteExternalFile function

Future<void> deleteExternalFile(
  1. String fileUrl, {
  2. ResourceContentType contentType = ResourceContentType.turtleText,
})

Delete an external file with path fileUrl and the shared key if the file is encrypted. Throws an exception if the file does not exist or any error occurs.

Implementation

Future<void> deleteExternalFile(
  String fileUrl, {
  ResourceContentType contentType = ResourceContentType.turtleText,
}) async {
  await deleteResource(fileUrl, contentType);
  await deleteAclForResource(fileUrl);
  if (await KeyManager.hasSharedIndividualKey(fileUrl)) {
    final webId = await AuthDataManager.getWebId();
    final resUniqueId = getUniqueIdResUrl(fileUrl, webId!);

    await KeyManager.removeSharedIndividualKey(fileUrl, resUniqueId);
  }

  /// av: Need to add the funtionality to remove the log line from permission
  /// log. Otherwise, it will give an error.
}