Conversation
|
Note
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title mentions 'attachement endpoint' which is the core feature added (AttachmentController with download endpoint), but contains a typo ('attachement' instead of 'attachment'). |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
feat/attachement-endpoint
No actionable comments were generated in the recent review. 🎉
🧹 Recent nitpick comments
src/Common/EventListener/ExceptionListener.php (1)
60-66: Consider masking internal error details in 500 responsesReturning
$exception->getMessage()verbatim for unhandled exceptions could leak internal details (class names, DB errors, file paths) to API consumers. A generic message like"Internal server error"is safer for production, with the real message logged server-side instead. No rush — just something to keep in mind.Suggested tweak
if ($exception instanceof Exception) { $event->setResponse( new JsonResponse([ - 'message' => $exception->getMessage() + 'message' => 'Internal server error' ], 500) ); }
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@composer.json`:
- Line 45: The composer.json currently pins phplist/core to the temporary branch
"dev-feat/attachment"; before merging, change that version constraint (the
"phplist/core" entry) to the intended long-term target (e.g., "dev-dev" or a
specific tagged release), update the composer.lock by running composer
update/install, commit the updated composer.json and composer.lock, and ensure
CI passes so the build no longer depends on the feature branch.
🧹 Nitpick comments (2)
src/Common/EventListener/ExceptionListener.php (1)
72-82: Consider consolidating these two 404 handlers & fix the double space.Both
AttachmentFileNotFoundExceptionandSubscriberNotFoundExceptionproduce identical 404 responses. You could combine them to reduce duplication. Also, line 82 has a double space beforeelseif.♻️ Optional consolidation
- } elseif ($exception instanceof AttachmentFileNotFoundException) { - $response = new JsonResponse([ - 'message' => $exception->getMessage(), - ], 404); - $event->setResponse($response); - } elseif ($exception instanceof SubscriberNotFoundException) { - $response = new JsonResponse([ - 'message' => $exception->getMessage(), - ], 404); - $event->setResponse($response); - } elseif ($exception instanceof Exception) { + } elseif ($exception instanceof AttachmentFileNotFoundException + || $exception instanceof SubscriberNotFoundException + ) { + $response = new JsonResponse([ + 'message' => $exception->getMessage(), + ], 404); + $event->setResponse($response); + } elseif ($exception instanceof Exception) {src/Messaging/Controller/AttachmentController.php (1)
77-92: Stream is never closed after reading.Once the while-loop drains the stream,
$downloadable->contentis left open. If the service returns afopen-backed stream, the handle leaks until GC. Explicitly closing it is a small but good habit.🔧 Suggested fix
while (!$stream->eof()) { echo $stream->read(8192); flush(); } + + $stream->close();
e7ec58c to
2a14796
Compare
d3a9dee to
c85162a
Compare
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Thanks for contributing to phpList!