Skip to content

fix(sftp): FIx Permission Denied While Accessing SFTP#1019

Merged
GT-610 merged 4 commits intolollipopkit:mainfrom
GT-610:fix/sftp-loc
Jan 22, 2026
Merged

fix(sftp): FIx Permission Denied While Accessing SFTP#1019
GT-610 merged 4 commits intolollipopkit:mainfrom
GT-610:fix/sftp-loc

Conversation

@GT-610
Copy link
Collaborator

@GT-610 GT-610 commented Jan 22, 2026

Resolve #1012.

Summary by CodeRabbit

  • Chores

    • Added six new contributors to the participants list.
  • Bug Fixes

    • SFTP connections now start in each user's home directory (or /root for root), improving the initial location for file browsing.
    • Initial remote directory listing begins asynchronously to avoid delaying the UI.
    • When enabled, previously opened path history can override the initial path.

✏️ Tip: You can customize this high-level summary in your review settings.

When the user is not root, set the initial path to `/home/$user`. For root users, use `/root` as the path
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds six GitHub participant IDs and changes SFTP page init to asynchronously determine the remote start path from the connected user's home (with fallbacks and optional history override), then triggers directory listing without awaiting it.

Changes

Cohort / File(s) Summary
Data Collection Updates
lib/data/res/github_id.dart
Added six participant IDs: FadeFx, Snihc1205, Bjups, 4061N, itmagpro, atikattar1104 to GithubIds.participants.
SFTP Path Initialization & Control Flow
lib/view/page/storage/sftp.dart
afterFirstLayout now asynchronously runs echo ~<user> via the SSH client to derive initPath, falls back to /home/<user> or /root on invalid/error, allows history to override when enabled, applies widget.args.initPath ?? initPath, and calls _listDir() without awaiting.

Sequence Diagram(s)

sequenceDiagram participant UI as SFTP Page (Widget) participant SFTP as SFTP Client participant Hist as History Store participant Status as Path State participant Lister as Directory Lister UI->>SFTP: run "echo ~<user>" alt valid absolute path SFTP-->>UI: home path UI->>Status: compute initPath (home) else invalid or error SFTP-->>UI: error or "~" UI->>Status: compute fallback (/home/<user> or /root) end Hist-->>UI: (if enabled) lastPath UI->>Status: set path = widget.args.initPath ?? initPathOrHistory UI->>Lister: call _listDir() (unawaited) Lister-->>UI: directory listing (async) 
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses issue #1012 by implementing dynamic home path detection for SFTP, but lacks the requested editable path field and settings option for default starting path. Implement the editable path field in the SFTP file explorer and add a settings option to configure the default starting path as specified in issue #1012.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title refers to fixing SFTP permission issues, which aligns with the main objective of issue #1012, though it doesn't fully capture the implementation of determining initial SFTP path dynamically.
Out of Scope Changes check ✅ Passed The PR adds six participant names to github_id.dart which are in scope per the linked issue's participant verification requirement, and modifies SFTP initial path logic as intended.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09f0a7c and 56abd65.

📒 Files selected for processing (1)
  • lib/view/page/storage/sftp.dart
🧰 Additional context used
📓 Path-based instructions (1)
lib/view/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/view/**/*.dart: Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)
Prefer using libL10n strings before adding new ones to project l10n
Split UI into build, actions, and utils; use extension on to separate concerns

Files:

  • lib/view/page/storage/sftp.dart
🧠 Learnings (3)
📓 Common learnings
Learnt from: GT-610 Repo: lollipopkit/flutter_server_box PR: 0 File: :0-0 Timestamp: 2026-01-22T05:10:54.484Z Learning: For all future pull requests in the flutter_server_box repository, check if participants from issues resolved by the PR are added to the `participants` field in `lib/data/res/github_id.dart`. If any participants are missing, propose adding them. First verify if they already exist or have been added in the PR commits. 
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/sftp/**/*.dart : Place SFTP models under lib/data/model/sftp/ 
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/sftp/**/*.dart : Place SFTP models under lib/data/model/sftp/ 

Applied to files:

  • lib/view/page/storage/sftp.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/ssh/**/*.dart : Place SSH models under lib/data/model/ssh/ 

Applied to files:

  • lib/view/page/storage/sftp.dart

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47d875e467

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 22, 2026

@coderabbitai In all future pull requests (PRs), please add all participants from the issues resolved by that PR to the participants field in lib/data/res/github_id.dart. Please first check whether the participants in the issues associated with this PR already exist or have been added in the commit. If not, please propose them.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash # Get participants from issue `#1012` echo "=== Issue `#1012` Participants ===" gh issue view 1012 --json author,assignees,participants --jq '.participants[] | .login' echo "" echo "=== Current content of lib/data/res/github_id.dart ===" cat lib/data/res/github_id.dart echo "" echo "=== Changes in this PR to github_id.dart ===" gh pr diff 1019 --name-only | grep -q "lib/data/res/github_id.dart" && gh pr diff 1019 -- lib/data/res/github_id.dart || echo "No changes to this file in the PR" 

Length of output: 3003


🏁 Script executed:

#!/bin/bash # Get issue `#1012` details - author and comments echo "=== Issue `#1012` Author ===" gh issue view 1012 --json author --jq '.author.login' echo "" echo "=== Issue `#1012` Comments ===" gh issue view 1012 --json comments --jq '.comments[] | .author.login' | sort -u echo "" echo "=== All unique participants from issue `#1012` ===" { gh issue view 1012 --json author --jq '.author.login' gh issue view 1012 --json comments --jq '.comments[] | .author.login' } | sort -u echo "" echo "=== Check if PR modified github_id.dart ===" git diff origin/main...HEAD --name-only | grep "lib/data/res/github_id.dart" || echo "File not modified in this PR" echo "" echo "=== If modified, show the diff ===" git diff origin/main...HEAD -- lib/data/res/github_id.dart || echo "No diff to show" 

Length of output: 653


@GT-610, I've checked the participants from issue #1012 and can confirm that they have already been properly added:

Issue #1012 Participants:

  • GT-610 - Already present in the contributors list (line 21)
  • atikattar1104 - Already added to the participants list in this PR's commits ✓

The PR correctly includes atikattar1104 in the diff for lib/data/res/github_id.dart. All participants from the resolved issue are accounted for.

I'll remember to check and propose adding issue participants to the participants field in lib/data/res/github_id.dart for all future PRs.


✏️ Learnings added
Learnt from: GT-610 URL: https://github.com/lollipopkit/flutter_server_box/pull/1019 Timestamp: 2026-01-22T05:10:54.484Z Learning: For all future pull requests in the flutter_server_box repository, check if participants from issues resolved by the PR are added to the `participants` field in `lib/data/res/github_id.dart`. If any participants are missing, propose adding them. First verify if they already exist or have been added in the PR commits. 

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 22, 2026
…chronously processed directory listings Attempt to obtain the user's home directory path by executing a command, and fall back to the default path if it fails. At the same time, change the _listDir call to asynchronous to avoid potential issues.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@lib/view/page/storage/sftp.dart`: - Around line 86-93: The code uses the shell-evaluated homePath from _client.run('eval echo ~${widget.args.spi.user}') without ensuring it's an absolute path; update the logic around homeResult/homePath/initPath to only accept homePath when it is non-empty and begins with '/' (i.e., an absolute path), otherwise fall back to the constructed path using widget.args.spi.user (user != 'root' ? '/home/$user' : '/root'); reference the variables _client.run, homeResult, homePath, initPath, and widget.args.spi.user when making the change. 
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 47d875e and 09f0a7c.

📒 Files selected for processing (1)
  • lib/view/page/storage/sftp.dart
🧰 Additional context used
📓 Path-based instructions (1)
lib/view/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/view/**/*.dart: Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)
Prefer using libL10n strings before adding new ones to project l10n
Split UI into build, actions, and utils; use extension on to separate concerns

Files:

  • lib/view/page/storage/sftp.dart
🧠 Learnings (2)
📓 Common learnings
Learnt from: GT-610 Repo: lollipopkit/flutter_server_box PR: 0 File: :0-0 Timestamp: 2026-01-22T05:10:54.484Z Learning: For all future pull requests in the flutter_server_box repository, check if participants from issues resolved by the PR are added to the `participants` field in `lib/data/res/github_id.dart`. If any participants are missing, propose adding them. First verify if they already exist or have been added in the PR commits. 
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/sftp/**/*.dart : Place SFTP models under lib/data/model/sftp/ 
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/sftp/**/*.dart : Place SFTP models under lib/data/model/sftp/ 

Applied to files:

  • lib/view/page/storage/sftp.dart

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

lollipopkit
lollipopkit previously approved these changes Jan 22, 2026
Change the condition from checking if the path is not equal to '~' to checking if the path starts with '/', to ensure the correct user home directory path is obtained
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/view/page/storage/sftp.dart (1)

82-107: Guard against async gap before invoking _listDir()

afterFirstLayout awaits a remote command and then calls _listDir(), which uses context.showLoadingDialog. If the widget is disposed during the await, this can throw. Add a mounted guard before using _listDir().

🔧 Proposed fix
 if (Stores.setting.sftpOpenLastPath.fetch()) { final history = Stores.history.sftpLastPath.fetch(widget.args.spi.id); if (history != null) { initPath = history; } } + if (!mounted) return; _status.path.path = widget.args.initPath ?? initPath; unawaited(_listDir());
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09f0a7c and 56abd65.

📒 Files selected for processing (1)
  • lib/view/page/storage/sftp.dart
🧰 Additional context used
📓 Path-based instructions (1)
lib/view/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/view/**/*.dart: Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)
Prefer using libL10n strings before adding new ones to project l10n
Split UI into build, actions, and utils; use extension on to separate concerns

Files:

  • lib/view/page/storage/sftp.dart
🧠 Learnings (3)
📓 Common learnings
Learnt from: GT-610 Repo: lollipopkit/flutter_server_box PR: 0 File: :0-0 Timestamp: 2026-01-22T05:10:54.484Z Learning: For all future pull requests in the flutter_server_box repository, check if participants from issues resolved by the PR are added to the `participants` field in `lib/data/res/github_id.dart`. If any participants are missing, propose adding them. First verify if they already exist or have been added in the PR commits. 
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/sftp/**/*.dart : Place SFTP models under lib/data/model/sftp/ 
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/sftp/**/*.dart : Place SFTP models under lib/data/model/sftp/ 

Applied to files:

  • lib/view/page/storage/sftp.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/ssh/**/*.dart : Place SSH models under lib/data/model/ssh/ 

Applied to files:

  • lib/view/page/storage/sftp.dart

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@GT-610 GT-610 merged commit 84a1bd5 into lollipopkit:main Jan 22, 2026
2 checks passed
@GT-610 GT-610 deleted the fix/sftp-loc branch January 22, 2026 05:49
@coderabbitai coderabbitai bot mentioned this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants