-
-
Notifications
You must be signed in to change notification settings - Fork 199
feat: Support modifying attachments after init (continued) #1266
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
fb699b9
feat: Support modifying attachments after init
Swatinem 72341ec
feat: pass added and removed attachments to the backend
jpnurmi 9a317be
add `_n`
jpnurmi 5ca524d
scope api
jpnurmi 9569d04
merge & apply attachments
jpnurmi 9c99b5d
update note on attachments
jpnurmi 30cf867
integration tests
jpnurmi 55336fc
Update README.md
jpnurmi 32a6aea
Update CHANGELOG.md
jpnurmi 09c9dc4
Apply suggestions from code review
jpnurmi 7200e78
remove ticks
jpnurmi 939a918
Apply more suggestions from code review
jpnurmi 12c7b56
De-duplicate envelope attachment code
jpnurmi b8e47dc
sentry_add_attachment -> sentry_add_attachment_path
jpnurmi d672c29
Update CHANGELOG.md
jpnurmi 17197d4
fixup: missed rename
jpnurmi e9a2df1
fixup: another missed rename
jpnurmi a542aca
remove_attachmentw() without _path
jpnurmi 3a0cb45
revise sentry_attach_file & removal
jpnurmi 5a00273
fix windows
jpnurmi 759caa0
Update CHANGELOG.md
jpnurmi deb6fce
clean up
jpnurmi d36e17b
fix attachments_add_remove on windows
jpnurmi 62eff3b
Update CHANGELOG.md & NOTE on attachments
jpnurmi 05b138f
Update external/crashpad
jpnurmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule crashpad
updated
15 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #include "sentry_attachment.h" | ||
| #include "sentry_alloc.h" | ||
| #include "sentry_path.h" | ||
|
|
||
| static void | ||
| attachment_free(sentry_attachment_t *attachment) | ||
| { | ||
| if (!attachment) { | ||
| return; | ||
| } | ||
| sentry__path_free(attachment->path); | ||
| sentry_free(attachment); | ||
| } | ||
|
|
||
| void | ||
| sentry__attachments_free(sentry_attachment_t *attachments) | ||
| { | ||
| sentry_attachment_t *it = attachments; | ||
| while (it) { | ||
| sentry_attachment_t *attachment = it; | ||
| it = attachment->next; | ||
|
|
||
| attachment_free(attachment); | ||
| } | ||
| } | ||
|
|
||
| sentry_attachment_t * | ||
| sentry__attachments_add(sentry_attachment_t **attachments_ptr, | ||
| sentry_path_t *path, sentry_attachment_type_t attachment_type, | ||
| const char *content_type) | ||
| { | ||
| if (!path) { | ||
| return NULL; | ||
| } | ||
| sentry_attachment_t *attachment = SENTRY_MAKE(sentry_attachment_t); | ||
| if (!attachment) { | ||
| sentry__path_free(path); | ||
| return NULL; | ||
| } | ||
| attachment->path = path; | ||
| attachment->next = NULL; | ||
| attachment->type = attachment_type; | ||
| attachment->content_type = content_type; | ||
|
|
||
| sentry_attachment_t **next_ptr = attachments_ptr; | ||
|
|
||
| for (sentry_attachment_t *it = *attachments_ptr; it; it = it->next) { | ||
| if (sentry__path_eq(it->path, path)) { | ||
| attachment_free(attachment); | ||
| return it; | ||
| } | ||
|
|
||
| next_ptr = &it->next; | ||
| } | ||
|
|
||
| *next_ptr = attachment; | ||
| return attachment; | ||
| } | ||
|
|
||
| void | ||
| sentry__attachments_remove( | ||
| sentry_attachment_t **attachments_ptr, sentry_attachment_t *attachment) | ||
| { | ||
| if (!attachment) { | ||
| return; | ||
| } | ||
|
|
||
| sentry_attachment_t **next_ptr = attachments_ptr; | ||
|
|
||
| for (sentry_attachment_t *it = *attachments_ptr; it; it = it->next) { | ||
| if (it == attachment || sentry__path_eq(it->path, attachment->path)) { | ||
| *next_ptr = it->next; | ||
| attachment_free(it); | ||
| return; | ||
| } | ||
|
|
||
| next_ptr = &it->next; | ||
| } | ||
| } | ||
|
|
||
| void | ||
| sentry__attachments_extend( | ||
| sentry_attachment_t **attachments_ptr, sentry_attachment_t *attachments) | ||
| { | ||
| for (sentry_attachment_t *it = attachments; it; it = it->next) { | ||
| sentry__attachments_add(attachments_ptr, sentry__path_clone(it->path), | ||
| it->type, it->content_type); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #ifndef SENTRY_ATTACHMENT_H_INCLUDED | ||
| #define SENTRY_ATTACHMENT_H_INCLUDED | ||
|
|
||
| #include "sentry_boot.h" | ||
|
|
||
| #include "sentry_path.h" | ||
|
|
||
| /** | ||
| * The attachment_type. | ||
| */ | ||
| typedef enum { | ||
| ATTACHMENT, | ||
| MINIDUMP, | ||
| VIEW_HIERARCHY, | ||
| } sentry_attachment_type_t; | ||
|
|
||
| /** | ||
| * This is a linked list of all the attachments registered via | ||
| * `sentry_options_add_attachment`. | ||
| */ | ||
| struct sentry_attachment_s { | ||
| sentry_path_t *path; | ||
| sentry_attachment_type_t type; | ||
| const char *content_type; | ||
| sentry_attachment_t *next; | ||
| }; | ||
|
|
||
| /** | ||
| * Frees the linked list of `attachments`. | ||
| */ | ||
| void sentry__attachments_free(sentry_attachment_t *attachments); | ||
|
|
||
| /** | ||
| * Adds an attachment to the attachments list at `attachments_ptr`. | ||
| */ | ||
| sentry_attachment_t *sentry__attachments_add( | ||
| sentry_attachment_t **attachments_ptr, sentry_path_t *path, | ||
| sentry_attachment_type_t attachment_type, const char *content_type); | ||
|
|
||
| /** | ||
| * Removes an attachment from the attachments list at `attachments_ptr`. | ||
| */ | ||
| void sentry__attachments_remove( | ||
| sentry_attachment_t **attachments_ptr, sentry_attachment_t *attachment); | ||
|
|
||
| /** | ||
| * Extends the linked list of attachments at `attachments_ptr` with all | ||
| * attachments in `attachments`. | ||
| */ | ||
| void sentry__attachments_extend( | ||
| sentry_attachment_t **attachments_ptr, sentry_attachment_t *attachments); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.