Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Invalid indexed media file #526

Open
AbsurdlySuspicious opened this issue Nov 13, 2021 · 0 comments
Open

Invalid indexed media file #526

AbsurdlySuspicious opened this issue Nov 13, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@AbsurdlySuspicious
Copy link
Collaborator

Reported in #525

Downloaded media creates a 0 byte ghost copy in /Internal Memory/Pictures/

the file itself doesn't appear to exist, though it shows up in all gallery apps I tested. The exact path is /storage/emulated/0/Pictures/.jpg.

Main suspect is:

// try to update mtime on already indexed file
int updatedCount = resolver.update(contentUri, values,
MediaStore.MediaColumns.DATA + "=?",
new String[]{ userFilePath });
if (updatedCount <= 0) {
// broadcast new file
values.put(MediaStore.MediaColumns.DATA, userFilePath);
values.put(MediaStore.MediaColumns.TITLE, mediaFileName);
values.put(MediaStore.MediaColumns.DISPLAY_NAME, mediaFileName);
resolver.insert(contentUri, values);
}
MediaScannerConnection.scanFile(
MediaDownloadService.this,
new String[]{ userFilePath },
null, null);

just scanFile should be enough, needs testing

@AbsurdlySuspicious AbsurdlySuspicious added the bug Something isn't working label Nov 13, 2021
@AbsurdlySuspicious AbsurdlySuspicious self-assigned this Nov 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant