From c4268b7c30f5709d9a29f09edf73e21066ed89cf Mon Sep 17 00:00:00 2001 From: Dawei Chen Date: Mon, 2 Feb 2026 10:21:06 +1100 Subject: [PATCH 1/5] Debug printing --- lib/src/solid/api/rest_api.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/src/solid/api/rest_api.dart b/lib/src/solid/api/rest_api.dart index 0121180f..ea7f2f4d 100644 --- a/lib/src/solid/api/rest_api.dart +++ b/lib/src/solid/api/rest_api.dart @@ -570,6 +570,19 @@ Future getResourceMetadata(String resourceUrl) async { 'en_US', ); + print('contentLength: ${int.parse(response.headers[contentLength]!)}'); + print('contentType: ${response.headers[contentType]!}'); + print( + 'lastModified: ${dateFormatter.parseUtc(response.headers[lastModified]!)}'); + print('eTag: ${response.headers[eTag]!}'); + print( + 'lastAccessed: ${dateFormatter.parseUtc(response.headers[lastAccessed]!)}'); + print('acceptPatch: ${response.headers[acceptPatch]!}'); + + final wacAllowStr = + response.headers[wacAllow]!.replaceAll('user=', '').replaceAll('"', ''); + print('wacAllow: $wacAllowStr'); + ResourceMetadata metadata = ResourceMetadata( contentLength: int.parse(response.headers[contentLength]!), contentType: response.headers[contentType]!, From 6f4893d6946d44336fc04c8716db095c64f26c05 Mon Sep 17 00:00:00 2001 From: Dawei Chen Date: Mon, 2 Feb 2026 11:26:54 +1100 Subject: [PATCH 2/5] Change lastAccessed to nullable as it may not available in web app --- lib/src/solid/api/rest_api.dart | 17 +++-------------- lib/src/solid/utils/res_metadata.dart | 8 +++++++- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/lib/src/solid/api/rest_api.dart b/lib/src/solid/api/rest_api.dart index ea7f2f4d..778d2a62 100644 --- a/lib/src/solid/api/rest_api.dart +++ b/lib/src/solid/api/rest_api.dart @@ -570,25 +570,14 @@ Future getResourceMetadata(String resourceUrl) async { 'en_US', ); - print('contentLength: ${int.parse(response.headers[contentLength]!)}'); - print('contentType: ${response.headers[contentType]!}'); - print( - 'lastModified: ${dateFormatter.parseUtc(response.headers[lastModified]!)}'); - print('eTag: ${response.headers[eTag]!}'); - print( - 'lastAccessed: ${dateFormatter.parseUtc(response.headers[lastAccessed]!)}'); - print('acceptPatch: ${response.headers[acceptPatch]!}'); - - final wacAllowStr = - response.headers[wacAllow]!.replaceAll('user=', '').replaceAll('"', ''); - print('wacAllow: $wacAllowStr'); - ResourceMetadata metadata = ResourceMetadata( contentLength: int.parse(response.headers[contentLength]!), contentType: response.headers[contentType]!, lastModified: dateFormatter.parseUtc(response.headers[lastModified]!), eTag: response.headers[eTag]!, - lastAccessed: dateFormatter.parseUtc(response.headers[lastAccessed]!), + lastAccessed: response.headers.containsKey(lastAccessed) + ? dateFormatter.parseUtc(response.headers[lastAccessed]!) + : null, acceptPatch: response.headers[acceptPatch]!, wacAllow: response.headers[wacAllow]! .replaceAll('user=', '') diff --git a/lib/src/solid/utils/res_metadata.dart b/lib/src/solid/utils/res_metadata.dart index c9789f79..8b1845c2 100644 --- a/lib/src/solid/utils/res_metadata.dart +++ b/lib/src/solid/utils/res_metadata.dart @@ -41,7 +41,13 @@ class ResourceMetadata { final DateTime lastModified; // The date and time at which the message originate - final DateTime lastAccessed; + // + // dc 20260202: Make the property nullable, as the + // property corresponds to the `date` field of the + // HTTP HEAD response headers. However, `date` may + // not exist if the request is from a web app. + + DateTime? lastAccessed; // A unique string identifying the version of the resource final String eTag; From 2c2e59c44b117bde9e1f60f1666044d1a9b15633 Mon Sep 17 00:00:00 2001 From: Dawei Chen <13044715+cdawei@users.noreply.github.com> Date: Thu, 5 Feb 2026 10:52:47 +1100 Subject: [PATCH 3/5] dc/577 delete by url (#583) * Use named parameter fileUrl in deleteFile() * Code adaptation * Update docstring * Update change log --------- Co-authored-by: cdawei <> --- CHANGELOG.md | 1 + lib/src/solid/common_func.dart | 2 +- lib/src/solid/utils/misc.dart | 17 ++++++++--------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 234c50c3..dd989837 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Visit the package at [pub.dev](https://pub.dev/packages/solidpod). ## 0.10 Further UI migrations ++ Delete file by URL + Add fetch resource metadata function [0.9.20 20260131 anushkavid] + Refactor constants, security, and reactivity [0.9.19 20260131 miduo] + Update permission table to list [0.9.18 20260129 jesscmoore] diff --git a/lib/src/solid/common_func.dart b/lib/src/solid/common_func.dart index b788f800..c00f7987 100644 --- a/lib/src/solid/common_func.dart +++ b/lib/src/solid/common_func.dart @@ -86,7 +86,7 @@ Future deleteDataFileDialog( actions: [ ElevatedButton( onPressed: () async { - await deleteFile(filePath, contentType: contentType); + await deleteFile(fileUrl: fileUrl, contentType: contentType); if (context.mounted) { Navigator.pop(context); ScaffoldMessenger.of(context).showSnackBar( diff --git a/lib/src/solid/utils/misc.dart b/lib/src/solid/utils/misc.dart index 5b399586..bc7b5f80 100644 --- a/lib/src/solid/utils/misc.dart +++ b/lib/src/solid/utils/misc.dart @@ -562,7 +562,7 @@ Future deleteAclForResource(String resourceUrl) async { } /// Delete a file and its associated resources, after first revoking -/// external access to the file. The file with path [filePath], +/// external access to the file. The file with URL [fileUrl], /// its ACL file, and its encryption key (if exists) will be deleted. /// The permission logs of any recipients to the file, will also be /// updated with a log line recording that permissions have been @@ -571,23 +571,24 @@ Future deleteAclForResource(String resourceUrl) async { /// /// Arguments: /// -/// - [filePath] - path of file to be deleted. Where [filePath] is the -/// app data directory and the filename. +/// - [fileUrl] - URL of file to be deleted. /// - [contentType] - the type of content of the resource. Default: /// [ResourceContentType.turtleText]. /// - [isKey] - flag describing whether the file to be deleted is a /// security key. Use this flag if file is a security key to avoid /// unnecessary operations that are not needed to delete a key. -Future deleteFile( - String filePath, { +Future deleteFile({ + required String fileUrl, ResourceContentType contentType = ResourceContentType.turtleText, bool isKey = false, }) async { - final fileUrl = await getFileUrl(filePath); if (await isFileProtected(fileUrl)) { throw Exception('Delete protected file is not allowed'); } + + final filePath = await extractResourcePathFromUrl(fileUrl); + if (!isKey) { // File to be deleted != key => perform all steps @@ -597,9 +598,7 @@ Future deleteFile( // file that is being deleted. // 20260112 jesscmoore: Assumes user is owner which is // always true in deleteFile(). - await revokePermissionToRecipients( - fileName: filePath, - ); + await revokePermissionToRecipients(fileName: filePath); await deleteResource(fileUrl, contentType); await deleteAclForResource(fileUrl); From 13bde75e6d257fbb9cc06189396dbbb90e181d61 Mon Sep 17 00:00:00 2001 From: cdawei <> Date: Fri, 6 Feb 2026 00:50:59 +1100 Subject: [PATCH 4/5] Delete ACL file of a file may not be necessary --- lib/src/solid/utils/misc.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/solid/utils/misc.dart b/lib/src/solid/utils/misc.dart index bc7b5f80..7873c2a4 100644 --- a/lib/src/solid/utils/misc.dart +++ b/lib/src/solid/utils/misc.dart @@ -601,7 +601,11 @@ Future deleteFile({ await revokePermissionToRecipients(fileName: filePath); await deleteResource(fileUrl, contentType); - await deleteAclForResource(fileUrl); + + // dc 20260206: ACL file seems to be deleted by the POD server + // when the file is deleted + // + // await deleteAclForResource(fileUrl); await KeyManager.removeIndividualKey(resourcePath: filePath); } else { // File to be deleted == key => perform delete only @@ -617,7 +621,7 @@ Future deleteExternalFile( ResourceContentType contentType = ResourceContentType.turtleText, }) async { await deleteResource(fileUrl, contentType); - await deleteAclForResource(fileUrl); + // await deleteAclForResource(fileUrl); await KeyManager.removeSharedIndividualKey(fileUrl); /// av: Need to add the funtionality to remove the log line from permission From 27fa6744d3faa5206ded9d9fd81af04a29058cfc Mon Sep 17 00:00:00 2001 From: Graham Williams Date: Fri, 6 Feb 2026 09:37:37 +1100 Subject: [PATCH 5/5] Update solidui dep. --- example/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 0c8bd8fc..23adda3e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -25,7 +25,7 @@ dependency_overrides: solidui: git: url: https://github.com/anusii/solidui - ref: jess/190_ui_const_for_perm_history # dev + ref: dev dev_dependencies: flutter_lints: ^6.0.0