Skip to content

Conversation

@tustanivsky
Copy link
Collaborator

This PR adds the ability to attach files and binary data to feedback submissions allowing users to include screenshots, logs or other contextual information alongside their text messages.

The initial request to add attachment support for user feedback originated from the Unreal SDK:

Here, a hint pattern is used (borrowed from the Android SDK) which relies on an opaque pointer to provide a standardized way to attach optional context or metadata to feedback without modifying its core value.

Example usage:

// Create the feedback (what to send)
sentry_value_t feedback = sentry_value_new_feedback(...);

// Create a hint
sentry_feedback_hint_t *hint = sentry_feedback_hint_new();
sentry_feedback_hint_attach_file(hint, "screenshot.png");

// Capture feedback with hint (both are freed automatically)
sentry_capture_feedback_with_hint(feedback, hint);

Example feedback with two image attachments.

Current implementation focuses on the feedback use case but it leaves room for an easy refactor to support additional APIs later on if needed.

@github-actions
Copy link

github-actions bot commented Oct 16, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 4c392e7

cursor[bot]

This comment was marked as outdated.


if (hint) {
sentry__feedback_hint_free(hint);
}
Copy link

Choose a reason for hiding this comment

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

Bug: Feedback Capture Function Ownership Violation

The sentry_capture_feedback_with_hint function leaks the user_feedback value. It fails to decrement the value's reference count when sentry isn't initialized or when prepare_user_feedback successfully creates an envelope, violating its ownership contract.

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If envelope was created successfully it takes ownership of the user_feedback value so we don't have to decref manually.

@jpnurmi
Copy link
Collaborator

jpnurmi commented Oct 17, 2025

Looks good at first glance, even though it feels like it's a lot of new API for a very specific use case. Since the goal is to add attachments to envelopes, I wonder if it would make sense to open up some of the existing but internal envelope APIs to make the same achievable in a more generic way. What do you think?

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.

2 participants