bare-url 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "WHATWG URL implementation for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -828,6 +828,11 @@ url__parse (url_t *url, const utf8_string_view_t input, const url_t *base) {
828
828
  url->components.port = base->components.port;
829
829
  }
830
830
  } else {
831
+ if (base->components.scheme_end + 3 /* :// */ == base->components.username_end) {
832
+ err = utf8_string_append_literal(&url->href, (utf8_t *) "//", 2);
833
+ if (err < 0) goto err;
834
+ }
835
+
831
836
  url->components.username_end = url->href.len;
832
837
  url->components.host_start = url->href.len;
833
838
  url->components.host_end = url->href.len;
@@ -928,6 +933,11 @@ url__parse (url_t *url, const utf8_string_view_t input, const url_t *base) {
928
933
  if (err < 0) goto err;
929
934
  }
930
935
  } else {
936
+ if (url->type == url_type_opaque && base->components.scheme_end + 3 /* :// */ == base->components.username_end) {
937
+ err = utf8_string_append_literal(&url->href, (utf8_t *) "//", 2);
938
+ if (err < 0) goto err;
939
+ }
940
+
931
941
  url->components.username_end = url->href.len;
932
942
  url->components.host_start = url->href.len;
933
943
  url->components.host_end = url->href.len;
@@ -43,7 +43,8 @@ utf8_string_init (utf8_string_t *string) {
43
43
 
44
44
  inline utf8_string_view_t
45
45
  utf8_string_view_init (const utf8_t *data, size_t len) {
46
- return (utf8_string_view_t){data, len};
46
+ utf8_string_view_t view = {data, len};
47
+ return view;
47
48
  }
48
49
 
49
50
  inline void