Skip to content

Commit

Permalink
fix: improved check on broken attachments, closes #2915
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Apr 19, 2024
1 parent 3e4223f commit 50d875f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions phpmyfaq/attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
}

if (
$attachment && ($faqConfig->get('records.allowDownloadsForGuests') ||
$attachment && $attachment->getRecordId() > 0 && ($faqConfig->get('records.allowDownloadsForGuests') ||
(($groupPermission || ($groupPermission && $userPermission)) && isset($permission['dlattachment'])))
) {
try {
Expand All @@ -108,7 +108,7 @@
}
exit(0);
} else {
$attachmentErrors[] = Translation::get('err_NotAuth');
$attachmentErrors[] = Translation::get('msgAttachmentInvalid');
}

// If we're here, there was an error with file download
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Attachment/AttachmentAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function setId(int $id): void
*/
public function getRecordId(): int
{
return $this->recordId;
return $this->recordId ?? 0;
}

/**
Expand Down

0 comments on commit 50d875f

Please sign in to comment.