If path is not set or empty do not run any media scanner

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-12-18 07:55:48 +01:00
parent cfb44f6b83
commit e6a7d124fc
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

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