Skip to content

Conversation

RoshniNaveenaS
Copy link
Contributor

This PR introduces support in the @cap-js/attachments plugin to work with custom key names (not just ID) for entities using the attachments composition. It enables both draft and non-draft flows to work correctly when the key field is named differently (e.g., bookId, customId, etc.).

Fixes #209

…params

Rewrote the nonDraftUpload function to avoid assuming the key name is ID. It now uses req.params[1] to access the correct key-value pairs for the Attachments entity. This makes the non-draft upload logic fully compatible with entities using custom key names instead of hardcoded ID.
Replaced the usage of hardcoded regex parsing in readAttachment with CAP’s req.params array to dynamically extract key values.
@schiwekM schiwekM closed this Oct 16, 2025
@schiwekM schiwekM deleted the fix/support-generic-primary-key-attachments branch October 16, 2025 09:11
@franksgit
Copy link

@schiwekM @RoshniNaveenaS do you have a timeline already when you will make this fix available in the released version? I am a bit confused why you now did delete the branch @schiwekM I had tested fix/support-generic-primary-key-attachments back then and it indeed had fixed the issue.

@schiwekM
Copy link
Contributor

Hi @franksgit,

it should be released next week. Could you checkout #276? At least from the coding there was another place which was not yet fixed by this PR which most likely contributed to your original issue.

BR,
Marten

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.

[Version: 2.1.2] issue deleting draft entity with a key that is not called ID

3 participants