Skip to content

Commit 2728b5f

Browse files
committed
Remove some pattern from etag page changes tracking
1 parent 1be8451 commit 2728b5f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app/models/etag_feed.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ class EtagFeed < Feed
33

44
include Html
55

6+
ETAG_IGNORED_PATTERSN = [
7+
# Some pages fight spam with random encoding of addresses
8+
/a href="mailto.*/,
9+
# some pages use timestamp to prevent caching of css
10+
/href="[^"]+" type=.text\/css./
11+
]
12+
613
def fill_missing_details
714
return if title.present?
815

@@ -16,6 +23,10 @@ def recent_media_items(*)
1623
return network_error_message(html_response)
1724
end
1825

26+
body = ETAG_IGNORED_PATTERSN.reduce(html_response.body) do |str, pattern|
27+
str.gsub(pattern, "")
28+
end
29+
1930
new_checksum = get_etag.presence || Digest::MD5.hexdigest(html_response.body)
2031
if html_response.code == 304 || new_checksum == etag
2132
[]

0 commit comments

Comments
 (0)