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

[share_plus] temporary XFiles directory not cleaned #1299

Closed
7 tasks done
Coronon opened this issue Oct 28, 2022 · 1 comment · Fixed by #1300
Closed
7 tasks done

[share_plus] temporary XFiles directory not cleaned #1299

Coronon opened this issue Oct 28, 2022 · 1 comment · Fixed by #1300
Labels
documentation Improvements or additions to documentation share_plus Feature, Enhancement, Bug Fixes for Share Plus Plugin

Comments

@Coronon
Copy link
Contributor

Coronon commented Oct 28, 2022

Platform

All

Plugin

share_plus

Version

>= 4.50

Flutter SDK

Any

Steps to reproduce

This is not really a ‘bug’ as in something is not working for the user, but as in undesirable behaviour.

Simply use shareXFiles without the files already having a path e.g. using XFile.fromData and experience your apps needed storage to increase by the filesize. While not having experienced this with share_plus, I used a similar approach for one of my apps lately. One would expect that the OS cleans up temporary storage - but it really does not until absolutely necessary, easily getting an app to a few GB.

The offending code lives in Future<List<XFile>> _getFiles(List<XFile> files), which is also why we refrained from providing the user with a way to pass raw bytes instead of handling a file himself before version 4.5.0.

Code Sample

No response

Logs

n.a.

Flutter Doctor

n.a.

Checklist before submitting a bug

  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@Coronon Coronon added bug Something isn't working triage labels Oct 28, 2022
@miquelbeltran
Copy link
Member

Yeah, I pointed that up when the PR was submitted, but as far as I understand, the use of the cache/temp directory is correct:

https://pub.dev/documentation/path_provider/latest/path_provider/getTemporaryDirectory.html

I think documenting this and reminding devs to clean this directory up once in a while when using shareXFile without paths would be enough.

@miquelbeltran miquelbeltran added documentation Improvements or additions to documentation share_plus Feature, Enhancement, Bug Fixes for Share Plus Plugin and removed bug Something isn't working triage labels Oct 28, 2022
miquelbeltran added a commit that referenced this issue Oct 28, 2022
Document the use of temporary directories and why developers should care about it.
miquelbeltran added a commit that referenced this issue Oct 29, 2022
Co-authored-by: Joachim Nohl <43643339+nohli@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation share_plus Feature, Enhancement, Bug Fixes for Share Plus Plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants