Skip to content

Commit 8122b01

Browse files
committed
fix: responds with http status 422
1 parent 57f350c commit 8122b01

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

app.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
require_relative 'roda/roda_plugins/basic_auth'
66

77
require 'html2rss'
8-
Zeitwerk::Loader.eager_load_all
9-
108
require_relative 'app/ssrf_filter_strategy'
119

1210
module Html2rss
@@ -92,10 +90,16 @@ def self.development? = ENV['RACK_ENV'] == 'development'
9290
config = Html2rss::Configs.find_by_name(name)
9391

9492
if (params = request.params).any?
93+
config = config.dup
9594
config[:params] ||= {}
9695
config[:params].merge!(params)
9796
end
9897

98+
unless config[:strategy]
99+
config = config.dup if config.frozen?
100+
config[:strategy] ||= Html2rss::RequestService.default_strategy_name
101+
end
102+
99103
feed = Html2rss.feed(config)
100104

101105
HttpCache.expires(response, feed.channel.ttl.to_i * 60, cache_control: 'public')
@@ -109,10 +113,16 @@ def self.development? = ENV['RACK_ENV'] == 'development'
109113
config = LocalConfig.find(File.basename(config_name_with_ext, '.*'))
110114

111115
if (params = request.params).any?
116+
config = config.dup
112117
config[:params] ||= {}
113118
config[:params].merge!(params)
114119
end
115120

121+
unless config[:strategy]
122+
config = config.dup if config.frozen?
123+
config[:strategy] ||= Html2rss::RequestService.default_strategy_name
124+
end
125+
116126
feed = Html2rss.feed(config)
117127

118128
HttpCache.expires(response, feed.channel.ttl.to_i * 60, cache_control: 'public')

0 commit comments

Comments
 (0)