-
Notifications
You must be signed in to change notification settings - Fork 11
Add filename to AttachmentSizeExceeded error message #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
SummaryThe following content is AI-generated and provides a summary of the pull request: Add filename to AttachmentSizeExceeded error messageBug Fix🐛 Bug Fix: Enhanced the file size exceeded error message to include the filename, improving user experience when uploading multiple files. Changes
GitHub Issues
PR Bot InformationVersion:
💌 Have ideas or want to contribute? Create an issue and share your thoughts with us! Made with ❤️ by Hyperspace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
I identified one critical bug in this pull request:
The database query at line 208 lacks proper error handling and can fail in several scenarios:
- When
req.data.up__IDis undefined or null (common in direct attachment operations) - When the query returns no results, causing destructuring to fail on
undefined - The query assumes a parent-child relationship that may not always exist
The fix should prioritize using req.data.filename (which is typically available during upload) and only fall back to a database query when necessary, with proper null-safety checks. This prevents runtime errors while still achieving the goal of including the filename in error messages.
The i18n message change itself is good and improves user experience by providing more context about which file exceeded the limit.
PR Bot Information
Version: 1.17.26 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- LLM:
anthropic--claude-4.5-sonnet - Correlation ID:
165d4c00-f5ee-11f0-84bc-92804ea13d09 - Event Trigger:
pull_request.opened
468ec76 to
a505596
Compare
a505596 to
a2525cd
Compare
…ce error messages with filenames
| const fs = require('fs/promises') | ||
| const { validateAttachmentSize } = require('../../lib/generic-handlers'); | ||
| const { newIncident } = require('../utils/testUtils'); | ||
| const { join } = cds.utils.path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint warning here
Fixes #359