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

Actually move images to the intended cache directory and ignore data URIs #6053

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mary-ext
Copy link
Contributor

@mary-ext mary-ext commented Nov 1, 2024

Need additional verification, cc @gaearon

Just realized that the moveIfNecessary function wasn't working as intended, the images never actually gets moved to our intended cache directory because from.startsWith(cacheDir) will always return false for those images.

Added an extra check to not do it for data URIs as well, to handle images coming from share intents, and images coming from local drafts (which I'm still working on).

…URIs

Just realized that the `moveIfNecessary` function wasn't working as intended, the images never actually gets moved to our intended cache directory because `from.startsWith(cacheDir)` will always return false for those images.

Added an extra check to not do it for data URIs as well, to handle images coming from share intents, and images coming from local drafts (which I'm still working on).
@gaearon
Copy link
Contributor

gaearon commented Nov 1, 2024

what’s the user visible consequence of the bug?

@mary-ext
Copy link
Contributor Author

mary-ext commented Nov 1, 2024

Nothing user-visible, we weren't actually deleting the temporary images as they weren't ever moved there to begin with.

@gaearon
Copy link
Contributor

gaearon commented Nov 1, 2024

sorry, this sounds silly but can you help me understand how to test this? what is the expected and the actual behavior (e.g. if i check the directory on the device).

@mary-ext
Copy link
Contributor Author

mary-ext commented Nov 1, 2024

will find some time to write up a test case tomorrow!

It is definitely hard to see what's going on, I'm not sure if file explorer apps on Android are able to peek into our cache directory so we might just have to check by putting console.logs on the before&after

@gaearon
Copy link
Contributor

gaearon commented Nov 1, 2024

i think i was able to inspect it with Android Studio in the past, just need to better understand what to look for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants