Merge pull request #6984 from nextcloud/newMediaScannerOnlyWithValidPath

New media scanner: only use with valid path
This commit is contained in:
Tobias Kaminsky 2020-09-22 07:40:38 +02:00 committed by GitHub
commit faad38835e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1718,7 +1718,7 @@ public class FileDataStorageManager {
if (path != null) {
ContentValues values = new ContentValues();
ContentResolver contentResolver = MainApp.getAppContext().getContentResolver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && !TextUtils.isEmpty(path)) {
if (file != null) {
values.put(MediaStore.Images.Media.MIME_TYPE, file.getMimeType());
values.put(MediaStore.Images.Media.TITLE, file.getFileName());