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

check status of external storage before file write/update #1221

Closed
wants to merge 4 commits into from
Closed

check status of external storage before file write/update #1221

wants to merge 4 commits into from

Conversation

templateK
Copy link

check status of external storage before file write/update

//private static final String LOG_TAG = "FileStorageUtils";

public static final boolean isStorageWritable() {
return Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should imho be implemented with an equals since you are comparing Strings and to make it null safe I would suggest:

return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());

@AndyScherzinger
Copy link
Contributor

Hi @templateK
Thanks for your PR. Can you give some more details on the reason for the PR as in what is the impact of it. I looked through the code changes and found just one minor issue with a String comparison.

In case this is your first PR to any ownCloud repo, please fill out the contributor agreement, see https://owncloud.org/contribute/agreement/ , sign it and send it to @karlitschek and probably to @masensio
The agreement is a precondition in order to contribute code to the owncloud repos.

@templateK
Copy link
Author

In file writing functions at FileDataStorageManager class,
(saveFile, saveFolder, moveLocalFile, copyLocalFile, updateSharedFiles)
they only checks existence of file on external storage.

Android external storage has many state for example, not-mounted, read-only etc.

So, I added condition that checks writable status of external storage to these functions.

@templateK
Copy link
Author

I didn't noticed that there's contributor agreement. Sorry, that for my bad.
I have decided that I won't contribute to this project. Feel free to close this PR.

@tobiasKaminsky
Copy link
Contributor

AFAIR you can also say that your code is under a special license, if you do not want to sign anything...

@ghost
Copy link

ghost commented Feb 22, 2016

User of the commit is unknown - cannot determine CLA

@LukeOwlclaw LukeOwlclaw mentioned this pull request Mar 18, 2016
@jesmrec jesmrec added this to the backlog milestone Jun 26, 2019
@jesmrec
Copy link
Collaborator

jesmrec commented Jun 26, 2019

closing... not scheduled

@jesmrec jesmrec closed this Jun 26, 2019
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.

4 participants