mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-24 07:40:26 +01:00
erpt: amend logic for culling orphan attachments
This commit is contained in:
parent
6b3bf10e46
commit
8e1cf7a7e0
@ -118,12 +118,17 @@ namespace ams::erpt::srv {
|
||||
|
||||
auto record_guard = SCOPE_GUARD { delete record; };
|
||||
|
||||
R_UNLESS(R_SUCCEEDED(Stream::GetStreamSize(std::addressof(record->info.attachment_size), Attachment::FileName(record->info.attachment_id).name)), erpt::ResultCorruptJournal());
|
||||
if (R_FAILED(Stream::GetStreamSize(std::addressof(record->info.attachment_size), Attachment::FileName(record->info.attachment_id).name))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (record->info.flags.Test<AttachmentFlag::HasOwner>() && JournalForReports::RetrieveRecord(record->info.owner_report_id) != nullptr) {
|
||||
/* NOTE: Nintendo does not check the result of storing the new record... */
|
||||
record_guard.Cancel();
|
||||
StoreRecord(record);
|
||||
} else {
|
||||
/* If the attachment has no owner (or we deleted the report), delete the file associated with it. */
|
||||
Stream::DeleteStream(Attachment::FileName(record->info.attachment_id).name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user