Skip to content

Conversation

@KoblerS
Copy link
Collaborator

@KoblerS KoblerS commented Jan 20, 2026

Fixes #359

@KoblerS KoblerS self-assigned this Jan 20, 2026
@hyperspace-insights
Copy link
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Add filename to AttachmentSizeExceeded error message

Bug Fix

🐛 Bug Fix: Enhanced the file size exceeded error message to include the filename, improving user experience when uploading multiple files.

Changes

  • _i18n/messages.properties: Updated the AttachmentSizeExceeded error message template to include both the filename and the maximum allowed size limit, making it more informative for end users.
  • lib/generic-handlers.js: Modified the validateAttachmentSize function to fetch and include the filename in the error response when file size validation fails. The function now queries the database to retrieve the filename associated with the attachment being uploaded.

GitHub Issues

  • #359: Include file name in the "exceeded file size" error message

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.17.26 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback


💌 Have ideas or want to contribute? Create an issue and share your thoughts with us!
📑 Check out the documentation for more information.

Made with ❤️ by Hyperspace.

Copy link
Contributor

@hyperspace-insights hyperspace-insights bot left a 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:

  1. When req.data.up__ID is undefined or null (common in direct attachment operations)
  2. When the query returns no results, causing destructuring to fail on undefined
  3. 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

@KoblerS KoblerS marked this pull request as ready for review January 21, 2026 06:47
@KoblerS KoblerS requested a review from a team as a code owner January 21, 2026 06:47
@KoblerS KoblerS force-pushed the add-filename-to-error-message branch from 468ec76 to a505596 Compare January 21, 2026 09:12
@KoblerS KoblerS force-pushed the add-filename-to-error-message branch from a505596 to a2525cd Compare January 21, 2026 09:35
@SirSimon04 SirSimon04 merged commit bb278f9 into main Jan 22, 2026
31 of 32 checks passed
@SirSimon04 SirSimon04 deleted the add-filename-to-error-message branch January 22, 2026 11:57
const fs = require('fs/promises')
const { validateAttachmentSize } = require('../../lib/generic-handlers');
const { newIncident } = require('../utils/testUtils');
const { join } = cds.utils.path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint warning here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include file name in the "exceeded file size" error message

5 participants