|
2 | 2 | #include "sentry_alloc.h" |
3 | 3 | #include "sentry_database.h" |
4 | 4 | #include "sentry_envelope.h" |
5 | | -#include "sentry_json.h" |
6 | 5 | #include "sentry_options.h" |
7 | 6 | #include "sentry_ratelimiter.h" |
8 | 7 | #include "sentry_retry.h" |
9 | 8 | #include "sentry_string.h" |
10 | 9 | #include "sentry_transport.h" |
11 | 10 | #include "sentry_utils.h" |
12 | | -#include "sentry_value.h" |
13 | 11 |
|
14 | 12 | #ifdef SENTRY_TRANSPORT_COMPRESSION |
15 | 13 | # include "zlib.h" |
@@ -289,37 +287,6 @@ http_send_request( |
289 | 287 | return resp.status_code; |
290 | 288 | } |
291 | 289 |
|
292 | | -static void |
293 | | -tus_resolve_item( |
294 | | - sentry_envelope_item_t *item, const char *location, bool is_inline) |
295 | | -{ |
296 | | - sentry_value_t loc_json; |
297 | | - if (is_inline) { |
298 | | - loc_json = sentry_value_new_object(); |
299 | | - const char *ref_ct = sentry_value_as_string( |
300 | | - sentry__envelope_item_get_header(item, "ref_content_type")); |
301 | | - if (ref_ct && *ref_ct != '\0') { |
302 | | - sentry_value_set_by_key( |
303 | | - loc_json, "content_type", sentry_value_new_string(ref_ct)); |
304 | | - } |
305 | | - } else { |
306 | | - size_t old_len = 0; |
307 | | - const char *old_payload |
308 | | - = sentry__envelope_item_get_payload(item, &old_len); |
309 | | - loc_json = sentry__value_from_json(old_payload, old_len); |
310 | | - sentry_value_remove_by_key(loc_json, "path"); |
311 | | - } |
312 | | - sentry_value_set_by_key( |
313 | | - loc_json, "location", sentry_value_new_string(location)); |
314 | | - |
315 | | - sentry_jsonwriter_t *jw = sentry__jsonwriter_new_sb(NULL); |
316 | | - sentry__jsonwriter_write_value(jw, loc_json); |
317 | | - sentry_value_decref(loc_json); |
318 | | - size_t new_len = 0; |
319 | | - char *new_payload = sentry__jsonwriter_into_string(jw, &new_len); |
320 | | - sentry__envelope_item_set_payload(item, new_payload, new_len); |
321 | | -} |
322 | | - |
323 | 290 | // TODO: with future creation-only TUS, this becomes a creation-only request |
324 | 291 | // (prepare_tus_request_common without a body) that obtains the location, and |
325 | 292 | // the actual data upload is queued as a separate bgworker task |
@@ -381,7 +348,7 @@ tus_upload_item(http_transport_state_t *state, sentry_envelope_item_t *item) |
381 | 348 | int status_code = ok ? resp.status_code : -1; |
382 | 349 |
|
383 | 350 | if (ok && resp.status_code == 201 && resp.location) { |
384 | | - tus_resolve_item(item, resp.location, is_inline); |
| 351 | + sentry__envelope_item_set_attachment_ref_location(item, resp.location); |
385 | 352 | } |
386 | 353 |
|
387 | 354 | http_response_cleanup(&resp); |
|
0 commit comments