2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00
Files
axios/lib/helpers
Abhishek Chauhan 5061879649 fix: update fromDataURI regex to match RFC 2397 (#10829)
* fix: update fromDataURI regex to match RFC 2397

Update the DATA_URL_PATTERN regex to correctly match all valid RFC 2397
data URIs. The previous regex required a semicolon-terminated media type
segment, which rejected valid data URIs like `data:;base64,MTIz` and
`data:application/octet-stream,123`.

Fixes #10808

* fix: normalize omitted mediatype to text/plain per RFC 2397

When a data URI has parameters but no mediatype (e.g. data:;charset=UTF-8,...),
prepend text/plain as the default per RFC 2397 section 3.

* fix: use stricter RFC 2397 regex and expand test matrix

- Switch to type/subtype-aware regex from #10808
- Require name=value parameters, separate ;base64 group
- Add tests: charset param, URL-encoded body, Blob type
  preservation, datax: rejection, missing comma rejection
- Normalize omitted mediatype to text/plain per RFC 2397 §3

* chore: apply small nits

---------

Co-authored-by: Abhishek Chauhan <abhishek-chauhan@outlook.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2026-05-05 19:23:16 +02:00
..
2022-06-18 11:19:27 +02:00
2016-06-01 13:16:16 -06:00

axios // helpers

The modules found in helpers/ should be generic modules that are not specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:

  • Browser polyfills
  • Managing cookies
  • Parsing HTTP headers