fileName(); try { $content = $disk->get($fileName); } catch (FileNotFoundException $e) { $this->error(sprintf('Could not find data for attachment #%d', $attachment->id)); continue; } try { $decrypted = Crypt::decrypt($content); } catch (DecryptException $e) { $this->error(sprintf('Could not decrypt data of attachment #%d', $attachment->id)); continue; } $tmpfname = tempnam(sys_get_temp_dir(), 'FireflyIII'); file_put_contents($tmpfname, $decrypted); $md5 = md5_file($tmpfname); $mime = mime_content_type($tmpfname); $attachment->md5 = $md5; $attachment->mime = $mime; $attachment->save(); $this->line(sprintf('Fixed attachment #%d', $attachment->id)); } } }