berns 3.2.0 → 3.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d9597d10ff728258b758e65aca73ec692374d3d359acb976677f0e143800978
4
- data.tar.gz: 8eb851e88a7674a5d9e9af5f111085af87bb958db03f0539574bdd9358dad9be
3
+ metadata.gz: 74e861ab5e3bfb8359f063dc7637b4f9c8f30ed60722b3f6cfec7aaf432915af
4
+ data.tar.gz: 17e884c022d55c44ad4ff080ec485d82688664529aee4d656b95d1d93a129e31
5
5
  SHA512:
6
- metadata.gz: 6e62bb1798243beab62f44e1ba7a3fc211b53997ce44e4ba37e6c46303974a96d4391d3fcdb9c807f3b894f097e9d3c823831026d4dca645362b21f4cab050da
7
- data.tar.gz: 047c09ea060864337ee852e51b85964bfed265009123e290e17d0f3b51782aca5ad3ca877ea45195536e8a93258dd5536e66c6e553d6afc5dfcbf970bccf7807
6
+ metadata.gz: 17166b6a903fba75f3cf3984710735e92206892eec6310bb2144ff5e088694089326426baf2c8e7c1246e681d4887559f01f7364635bfc29006878a908b9912f
7
+ data.tar.gz: 9472135003033d1fdc6db413e44cf7ab69be6fa947b9e2a452d2bd24f316f0708055d03d6157adf292c5b9644d73dd08cad261c1b4c45588be18b8069e5366e2
data/ext/berns/berns.c CHANGED
@@ -112,10 +112,12 @@ static VALUE external_sanitize(RB_UNUSED_VAR(VALUE self), VALUE string) {
112
112
  char dest[slen + 1];
113
113
  int index = 0;
114
114
  int open = 0;
115
+ int opened = 0;
115
116
 
116
117
  for (unsigned int i = 0; i < slen; i++) {
117
118
  if (str[i] == '<') {
118
119
  open = 1;
120
+ opened = 1;
119
121
  } else if (str[i] == '>') {
120
122
  open = 0;
121
123
  } else if (!open) {
@@ -125,7 +127,15 @@ static VALUE external_sanitize(RB_UNUSED_VAR(VALUE self), VALUE string) {
125
127
 
126
128
  dest[index] = '\0';
127
129
 
128
- return rb_utf8_str_new_cstr(dest);
130
+ /*
131
+ * If a tag was never opened, return the original string, otherwise create a new
132
+ * string from our destination buffer.
133
+ */
134
+ if (opened) {
135
+ return rb_utf8_str_new_cstr(dest);
136
+ } else {
137
+ return string;
138
+ }
129
139
  }
130
140
 
131
141
  /*
data/lib/berns/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Berns
3
- VERSION = '3.2.0'
3
+ VERSION = '3.2.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berns
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Beck
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-14 00:00:00.000000000 Z
12
+ date: 2021-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: benchmark-ips