takeout: skip migration if blank exif

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/504/head
Varun Patil 2023-03-16 23:47:12 -07:00
parent 337d466644
commit e301ee84cb
1 changed files with 7 additions and 0 deletions

View File

@ -199,6 +199,13 @@ class MigrateGoogleTakeout extends Command
// Get current EXIF metadata // Get current EXIF metadata
$exif = Exif::getExifFromFile($file); $exif = Exif::getExifFromFile($file);
// Check if EXIF is blank, which is probably wrong
if (0 === \count($exif)) {
$this->output->writeln("<error>EXIF metadata for {$path} is blank, probably an error</error>");
return;
}
// Keep keys that are not in EXIF unless --override is specified // Keep keys that are not in EXIF unless --override is specified
if (!((bool) $this->input->getOption('override'))) { if (!((bool) $this->input->getOption('override'))) {
$txf = array_filter($txf, function ($value, $key) use ($exif) { $txf = array_filter($txf, function ($value, $key) use ($exif) {