Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NetworkOnMainThreadException on HybridFile.getUsableSpace() and HybridFileParcelable.isDirectory() #3999

Merged
merged 5 commits into from
Dec 6, 2023

Conversation

TranceLove
Copy link
Collaborator

Description

  • Fix SmbFile.getDiskSpace() was not wrapped with RxJava in HybridFile.getUsableSpace() for network calls
  • Added HybridFileParcelable.isDirectory(Context) that made copy and paste remote folders unnecessary long, especially when remote is SSH server

Issue tracker

Fixes #3982

Manual tests

  • Done

Device:

  • Pixel 5 emulator running Android 11
  • Fairphone 3 running LineageOS 20 (13)

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

To prevent unnecessary calls to superclass method when information is already available at HybridFileParcelable. This also fixes a problem that stops copying folders over SSH.
@TranceLove TranceLove added Issue-Bug Related unexpected behavior or something worth investigating. Area-SMB Related to SMB connections. labels Nov 28, 2023
@TranceLove TranceLove added this to the v3.9 milestone Nov 28, 2023
@TranceLove TranceLove self-assigned this Nov 28, 2023
Restrict only SMB and SSH HybridFileParcelables returns the isDirectory attribute; others will use the superclass (HybridFile) implementation.

Meanwhile, also fixes a potential flaw at HybridFile.isDirectory() for SMB files which is not wrapped in RxJava's Single in IO scheduler.
Toast the user if there is problem listing files. Hence LoadFilesListTask will have Throwable as progress update, for different list methods to feed exceptions to the UI.
@TranceLove
Copy link
Collaborator Author

Added an alert dialog which will pop up when attempt to load SMB server root without credentials failed.

Per Samba docs it indicates it's a good practice to restrict unauthenticated access to SMB server root, or in other words, the IPC$ share. But it's decent that some feedback to user is necessary.

@VishalNehra VishalNehra merged commit 4020096 into release/3.9 Dec 6, 2023
3 checks passed
@VishalNehra VishalNehra deleted the bugfix/3982 branch December 6, 2023 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-SMB Related to SMB connections. Issue-Bug Related unexpected behavior or something worth investigating.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants