make unzip specific to gzip to leave room for other methods

stvnrlly 10 ans auparavant
Parent
Commettre
4b9535d70d
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3 3
      app/models/agents/website_agent.rb

+ 3 - 3
app/models/agents/website_agent.rb

@@ -40,8 +40,6 @@ module Agents
40 40
             "description": { "path": "results.data[*].description" }
41 41
           }
42 42
 
43
-      If your JSON is compressed with `gzip`, set the `unzip` option to `true` to inflate it before extraction.
44
-
45 43
       When parsing text, each sub-hash should contain a `regexp` and `index`.  Output text is matched against the regular expression repeatedly from the beginning through to the end, collecting a captured group specified by `index` in each match.  Each index should be either an integer or a string name which corresponds to <code>(?&lt;<em>name</em>&gt;...)</code>.  For example, to parse lines of <code><em>word</em>: <em>definition</em></code>, the following should work:
46 44
 
47 45
           "extract": {
@@ -80,6 +78,8 @@ module Agents
80 78
 
81 79
       Set `disable_ssl_verification` to `true` to disable ssl verification.
82 80
 
81
+      Set `unzip` to `gzip` to inflate the resource using gzip.
82
+
83 83
       The WebsiteAgent can also scrape based on incoming events. It will scrape the url contained in the `url` key of the incoming event payload. If you specify `merge` as the mode, it will retain the old payload and update it with the new values.
84 84
 
85 85
       In Liquid templating, the following variable is available:
@@ -176,7 +176,7 @@ module Agents
176 176
         if (encoding = interpolated['force_encoding']).present?
177 177
           body = body.encode(Encoding::UTF_8, encoding)
178 178
         end
179
-        if interpolated['unzip'].present?
179
+        if interpolated['unzip'] == "gzip"
180 180
           body = ActiveSupport::Gzip.decompress(body)
181 181
         end
182 182
         doc = parse(body)