repost 0.5.2 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c72321c2698ca6688271f051495bae51c38f6ab3395833dba654314a33c5e942
4
- data.tar.gz: a24252efb08f6e194628c033c06acf61d28ef18ae075b25f294149e8b0da9412
3
+ metadata.gz: 41b967cb4d60089de6bdb34b27fa765201b3216186c7da3d0259b4ed18694ac4
4
+ data.tar.gz: a348d14926f1b1df688dd7d8bca93ad3f721f7f4259f366e6075447e48d63882
5
5
  SHA512:
6
- metadata.gz: 5cdc9fc605bf4358f9105a51d341d8b0bcf50f81e61787730fef1a9338e9ebaccb91f32ec795d570f9e7db08cf05ee57e8d413c2161444c24cbafe005c84e899
7
- data.tar.gz: 29850c217d7e15f1ef4df3a9eda4d772a98a7a728ace1969c18b52ef68676b338fd2c1df137f439c400a29250dcdbce42c47bc9cfff1856dcb28810d6f585c8c
6
+ metadata.gz: fcf88d8239d00a462d962b4659f6cb29c1ed85027941a73d96b06d014e76d019745318fb2a5d535d1c52051b3ed69f86f7fa7430066d12b8eaed38a4ce11fa32
7
+ data.tar.gz: b1e9ac130d2b5e8d2ae213da35ce40a3a5b6ffe468a7b536a9390935792cbb00d15d3a414f530810578ff515139101e74976c5915b18f79f56c8a551c64fa969
data/README.md CHANGED
@@ -14,7 +14,7 @@ Gem **Repost** implements Redirect using POST method.
14
14
  Implementation story and some details in the following article [Redirect using POST in Rails](https://medium.com/@momlookhowican/redirect-using-post-in-rails-5748da354343).
15
15
 
16
16
  [![Gem Version](https://badge.fury.io/rb/repost.svg)](https://badge.fury.io/rb/repost)
17
- [![Build Status](https://travis-ci.com/vergilet/repost.svg?branch=master)](https://app.travis-ci.com/github/vergilet/repost)
17
+ [![CI](https://github.com/vergilet/repost/actions/workflows/ci.yml/badge.svg)](https://github.com/vergilet/repost/actions/workflows/ci.yml)
18
18
 
19
19
  ## Installation
20
20
 
data/lib/repost/senpai.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'cgi'
2
+ require 'json'
2
3
  require 'securerandom'
3
4
 
4
5
  module Repost
@@ -108,11 +109,19 @@ module Repost
108
109
  "repost-#{SecureRandom.hex(8)}"
109
110
  end
110
111
 
112
+ # Calls the prototype's submit() so a param named "submit" (which the
113
+ # browser exposes as form.submit, shadowing the method) can't break it.
111
114
  def auto_submit_script
112
115
  nonce_attr = %Q( nonce="#{escape(autosubmit_nonce)}") if autosubmit_nonce
113
116
  %Q(<script#{nonce_attr}>
114
- document.getElementById("#{escape(form_id)}").submit();
117
+ HTMLFormElement.prototype.submit.call(document.getElementById(#{js_string(form_id)}));
115
118
  </script>)
116
119
  end
120
+
121
+ # A JS string literal that is also safe inside an HTML <script> element.
122
+ # HTML escaping is wrong here: entities are not decoded inside <script>.
123
+ def js_string(value)
124
+ JSON.generate(value.to_s).gsub(/[<>&

]/) { |char| format('\u%04x', char.ord) }
125
+ end
117
126
  end
118
127
  end
@@ -1,3 +1,3 @@
1
1
  module Repost
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - YaroslavO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-03 00:00:00.000000000 Z
11
+ date: 2026-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.4.6
78
+ rubygems_version: 3.5.22
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Gem implements Redirect using POST method