Blob constructor is not spec compliant
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
Description
The constructor for React Native's Blob has a comment:
"Currently we only support creating Blobs from other Blobs."
BlobManager confirms this:
"Creating blobs from 'ArrayBuffer' and 'ArrayBufferView' are not supported"
This API is not spec compliant, since this is what the Blob specification specifies:
(Constructed from) "An iterable object such as an Array, having ArrayBuffers, TypedArrays, DataViews, Blobs, strings, or a mix of any of such elements, that will be put inside the Blob. Strings should be well-formed Unicode, and lone surrogates are sanitized using the same algorithm as String.prototype.toWellFormed()."
Steps to reproduce
- Try to call:
new Blob(new Uint8Array([
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23,
]);
See that RN doesn't support Blobs composed of anything but Blobs or strings.
React Native Version
0.73.6
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx react-native info
N/A
Stacktrace or Logs
N/A
Reproducer
N/A
Screenshots and Videos
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem Lesen von packages/react-native/Libraries/Blob/Blob.js und packages/react-native/Libraries/Blob/BlobManager.js, insbesondere des Konstruktors und der bestehenden Behandlung nicht unterstützter Eingaben. Bestätige das aktuelle Verhalten auf Android und iOS und überprüfe anschließend, dass die Blob-Konstruktion die im Issue aufgeführten iterierbaren Eingabetypen akzeptiert und dabei die bestehende Unterstützung für Blob und Strings beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react-native
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100