getsentry / getsentry/sentry-react-native
Support File URIs for Attachments
- 主要言語
- TypeScript
- スター
- 1.8k
- フォーク
- 367
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 94
説明
I’d like to request that the Sentry React Native SDK expose the getDataFromUri function as a public API. Right now, I’m importing it privately like this:
``` typescript
import { NATIVE } from '@sentry/react-native/dist/js/wrapper';
const jsByteArray = await NATIVE.getDataFromUri(image.url);
if (bd) {
const attachment: Attachment = {
filename: file.name || `file_${0}.${mime.getType(file.mediaContentType)}`,
data: jsByteArray,
contentType: file.mediaContentType,
};
attachments.push(attachment);
}
```
Depending on an internal method isn’t ideal—it feels brittle and may stop working if the SDK changes. Exposing getDataFromUri (or providing a similar official method) would make it safer and more straightforward to attach user-supplied files in a feedback workflow.
Additionally, it would be great if the SDK directly supported attaching files via a platform-based file URI (e.g., file://...). The code could look like this:
``` typescript
const attachment: Attachment = {
filename: file.name || `file_${index}.${mime.getType(file.mediaContentType)}`,
uri: image.url, // "file://etc"
contentType: file.mediaContentType,
};
```
Internally, Sentry could then convert that URI into the data it needs. This would simplify the process for developers who want to attach files without manually handling the conversion. If there’s another recommended approach, I’d love to hear it—otherwise, making getDataFromUri public (and potentially enhancing it to handle URIs directly) would be a big help.
コントリビューションガイド
調査の方向性
まず、@sentry/react-native/dist/js/wrapper にある既存のエントリポイント NATIVE.getDataFromUri と、issue に示されている Attachment の形を確認します。受け入れられる範囲が、公開変換 API、file:// URI の直接添付、またはその両方のいずれであるかを明確にします。完了とは、公式にサポートされた添付ワークフローが非公開の wrapper メソッドに依存しなくなることを意味します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- react-native, typescript
- 領域
- mobile
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100