Skip to content

Tony/153 refactor file browsing code#198

Open
tonypioneer wants to merge 35 commits intodevfrom
tony/153_refactor_file_browsing_code
Open

Tony/153 refactor file browsing code#198
tonypioneer wants to merge 35 commits intodevfrom
tony/153_refactor_file_browsing_code

Conversation

@tonypioneer
Copy link
Collaborator

@tonypioneer tonypioneer commented Feb 5, 2026

Pull Request Details

What issue does this PR address

  • Fixed the issue that uploaded files will appear in unexpected directories.
  • Refactored file-browsing code built upon basePath.

Associated Issue

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Build and run the app.

Checklist

Complete the check-list below to ensure your branch is ready for PR.

  • Screenshots included in linked issue #
  • Changes adhere to the style and coding guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules
  • The update contains no confidential information
  • The update has no duplicated content
  • No lint check errors are related to these changes (make prep or flutter analyze lib)
  • Integration test dart test output or screenshot included in issue #
  • I tested the PR on these devices:
    • Android
    • iOS
    • Linux
    • MacOS
    • Windows
    • Web
  • I have identified reviewers
  • The PR has been approved by reviewers

Finalising

Once PR discussion is complete and reviewers have approved:

  • Merge dev into the this branch
  • Resolve any conflicts
  • Add a one line summary into the CHANGELOG.md
  • Push to the git repository and review
  • Merge the PR into dev

@tonypioneer tonypioneer requested a review from cdawei February 5, 2026 15:27
@tonypioneer tonypioneer linked an issue Feb 5, 2026 that may be closed by this pull request
@cdawei cdawei mentioned this pull request Feb 6, 2026
28 tasks
@tonypioneer tonypioneer changed the base branch from tony/193_unexpected_directory to dev February 6, 2026 03:46
@tonypioneer tonypioneer requested a review from cdawei February 6, 2026 05:21
@tonypioneer tonypioneer linked an issue Feb 6, 2026 that may be closed by this pull request
8 tasks
@tonypioneer tonypioneer linked an issue Feb 6, 2026 that may be closed by this pull request
8 tasks
@tonypioneer tonypioneer requested a review from cdawei February 6, 2026 12:51
@tonypioneer
Copy link
Collaborator Author

#199 has been merged to #154, and #154 has been merged to #153.

@cdawei
Copy link
Contributor

cdawei commented Feb 12, 2026

The logs reported accessing the following paths that contains leading / and duplicated // (noted this PR is still WIP).

2026-02-12T09:18:47.823Z [WebAclReader] {Primary} info: Found applicable ACL document https://pods.solidcommunity.au/dc101//.acl
2026-02-12T09:18:47.971Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//myapp/
2026-02-12T09:18:48.152Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//keypod/
2026-02-12T09:18:48.323Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//demopod/
2026-02-12T09:18:48.501Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//exampleApp/
2026-02-12T09:18:48.687Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//notepod/
2026-02-12T09:18:48.935Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//healthpod/
2026-02-12T09:18:49.153Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101/myapp/data/
2026-02-12T09:18:49.180Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//podnotes/
2026-02-12T09:18:49.314Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101/myapp/data/myapp/

Another observation is the large number (N+2) of REST calls to the CSS server after clicking All POD Files button (where , N is the number of sub directories in POD root directory). In particular, the chain of function calls:

AllPodFilesPage() -> SolidFile() -> SolidFileBrowserBuilder.build() -> SolidFileBrowser() ->
SolidFileBrowserState() -> initState() -> _resolveHomePath() -> _checkLoginStatus() -> refreshFiles() 

and in refreshFiles(), the following calls

  • getResourcesInContainer() makes one REST call
  • FileOperations.getDirectoryCounts() makes one REST call for each sub-folder
  • FileOperations.getFiles() makes one REST call

for total number of N+2 REST calls.

I wonder if some of these REST calls (e.g., REST calls to get the number items in a directory) can be deferred, for example, if we add a info icon button for each file and directory, then the REST call can be made when user clicks the info icon of the file or directory.

@cdawei
Copy link
Contributor

cdawei commented Feb 12, 2026

Also noted that the file modified time is incorrect, we probably need to use the getResourceMetadata() function from solidpod to get the lastModified time.

dateModified: DateTime.now(),

@tonypioneer
Copy link
Collaborator Author

The logs reported accessing the following paths that contains leading / and duplicated // (noted this PR is still WIP).

2026-02-12T09:18:47.823Z [WebAclReader] {Primary} info: Found applicable ACL document https://pods.solidcommunity.au/dc101//.acl
2026-02-12T09:18:47.971Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//myapp/
2026-02-12T09:18:48.152Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//keypod/
2026-02-12T09:18:48.323Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//demopod/
2026-02-12T09:18:48.501Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//exampleApp/
2026-02-12T09:18:48.687Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//notepod/
2026-02-12T09:18:48.935Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//healthpod/
2026-02-12T09:18:49.153Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101/myapp/data/
2026-02-12T09:18:49.180Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//podnotes/
2026-02-12T09:18:49.314Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101/myapp/data/myapp/

Another observation is the large number (N+2) of REST calls to the CSS server after clicking All POD Files button (where , N is the number of sub directories in POD root directory). In particular, the chain of function calls:

AllPodFilesPage() -> SolidFile() -> SolidFileBrowserBuilder.build() -> SolidFileBrowser() ->
SolidFileBrowserState() -> initState() -> _resolveHomePath() -> _checkLoginStatus() -> refreshFiles() 

and in refreshFiles(), the following calls

  • getResourcesInContainer() makes one REST call
  • FileOperations.getDirectoryCounts() makes one REST call for each sub-folder
  • FileOperations.getFiles() makes one REST call

for total number of N+2 REST calls.

I wonder if some of these REST calls (e.g., REST calls to get the number items in a directory) can be deferred, for example, if we add a info icon button for each file and directory, then the REST call can be made when user clicks the info icon of the file or directory.

Thank you very much @cdawei. I noticed that you mentioned a PR is still working in progress for the first issue. Which PR did you mean?

@cdawei
Copy link
Contributor

cdawei commented Feb 13, 2026

Thank you very much @cdawei. I noticed that you mentioned a PR is still working in progress for the first issue. Which PR did you mean?

I was just referring to this very PR #198, sorry for not being clear.

@tonypioneer
Copy link
Collaborator Author

dateModified: DateTime.now(),

Thanks @cdawei. This issue has been fixed.
image

@tonypioneer
Copy link
Collaborator Author

The logs reported accessing the following paths that contains leading / and duplicated // (noted this PR is still WIP).

2026-02-12T09:18:47.823Z [WebAclReader] {Primary} info: Found applicable ACL document https://pods.solidcommunity.au/dc101//.acl
2026-02-12T09:18:47.971Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//myapp/
2026-02-12T09:18:48.152Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//keypod/
2026-02-12T09:18:48.323Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//demopod/
2026-02-12T09:18:48.501Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//exampleApp/
2026-02-12T09:18:48.687Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//notepod/
2026-02-12T09:18:48.935Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//healthpod/
2026-02-12T09:18:49.153Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101/myapp/data/
2026-02-12T09:18:49.180Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101//podnotes/
2026-02-12T09:18:49.314Z [HandlerServerConfigurator] {Primary} info: Received GET request for /dc101/myapp/data/myapp/

Another observation is the large number (N+2) of REST calls to the CSS server after clicking All POD Files button (where , N is the number of sub directories in POD root directory). In particular, the chain of function calls:

AllPodFilesPage() -> SolidFile() -> SolidFileBrowserBuilder.build() -> SolidFileBrowser() ->
SolidFileBrowserState() -> initState() -> _resolveHomePath() -> _checkLoginStatus() -> refreshFiles() 

and in refreshFiles(), the following calls

  • getResourcesInContainer() makes one REST call
  • FileOperations.getDirectoryCounts() makes one REST call for each sub-folder
  • FileOperations.getFiles() makes one REST call

for total number of N+2 REST calls.

I wonder if some of these REST calls (e.g., REST calls to get the number items in a directory) can be deferred, for example, if we add a info icon button for each file and directory, then the REST call can be made when user clicks the info icon of the file or directory.

This issue has also been fixed. The following are the logs after the fix.

2026-02-13T13:12:26.046Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/data/
2026-02-13T13:12:26.115Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/0814ccba-f691-4631-9668-a01dc4749291/
2026-02-13T13:12:26.166Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/9f4226cf-cbb9-46bd-9e8e-c4f68732edce/
2026-02-13T13:12:26.894Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp
2026-02-13T13:12:27.018Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/805c80c7-70c2-451b-a47f-287ee461fac5/
2026-02-13T13:12:27.086Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/e735adc6-51f8-4490-9eba-73500a2f19ad/
2026-02-13T13:12:27.153Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/5fb04a7f-3bd6-4ee2-b18f-acde75b183b7/
2026-02-13T13:12:27.204Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/d45abf81-e863-4016-b475-d18024bc6a5a/
2026-02-13T13:12:27.253Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/shared/
2026-02-13T13:12:27.302Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/53907a1a-c34d-4d38-ad36-0f1ad0143159/
2026-02-13T13:12:27.353Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/b2995be7-c5ed-4d5e-9e47-4ed4cd5b45ca/
2026-02-13T13:12:27.410Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/bba781e2-8db9-40f3-ae21-477bfb8edb53/
2026-02-13T13:12:27.461Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/90c0a713-f277-44d9-a7f4-bd8dde0e7522/
2026-02-13T13:12:27.511Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/bc372c33-0934-409f-b7ed-cd8975e3b4e8/
2026-02-13T13:12:27.561Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/a0f2880c-f168-4fd2-b794-7b0b0d0cdfb0/
2026-02-13T13:12:27.619Z [HandlerServerConfigurator] {Primary} info: Received GET request for /tchen/myapp/16be8b50-55b7-40a1-9e0c-4c2d075c8881/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants