This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 7355dae4 Fetch csp if it is wanted and missing
7355dae4 is described below

commit 7355dae46bca098b2f4e1a8e29b1b190b8754874
Author: Sebb <[email protected]>
AuthorDate: Sat Oct 25 16:57:12 2025 +0100

    Fetch csp if it is wanted and missing
---
 lib/whimsy/cache.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/cache.rb b/lib/whimsy/cache.rb
index b2b7c10a..ab5a3eed 100644
--- a/lib/whimsy/cache.rb
+++ b/lib/whimsy/cache.rb
@@ -62,15 +62,15 @@ class Cache
     age, lastmod, uri, etag, data, csp = read_cache(url)
     Wunderbar.debug "#{uri} #{age} LM=#{lastmod} ET=#{etag}"
     if age < minage
-      if (@save_csp)
+      if @save_csp
         return uri, data, 'recent', csp # we have a recent cache entry
       else
         return uri, data, 'recent' # we have a recent cache entry
       end
     end
 
-    # Try to do a conditional get
-    if data and (lastmod or etag)
+    # Try to do a conditional get (unless csp is missing)
+    if data and (lastmod or etag) and (csp or !@save_csp)
       cond = {}
       cond['If-Modified-Since'] = lastmod if lastmod
       cond['If-None-Match'] = etag if etag

Reply via email to