diff options
author | Matthew Somerville <matthew@mysociety.org> | 2017-09-27 19:34:39 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2017-09-27 19:34:39 +0100 |
commit | 8890888e59ac83e503de4f19a6d84aabaf62aa20 (patch) | |
tree | 878d46b229f9f4df2dd18d28a76ad39dc4ebb041 | |
parent | d9481ccace557cf2b5fe8543aa1073b5e3ce2e91 (diff) |
Fix bug in cookie passthrough query parameter.
For temp URLs there was not already a query string, and
so "?" needs to be used rather than "&" when appending.
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 3b622b561..0c2dc2aa1 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -896,16 +896,20 @@ sub photos { # if LOGIN_REQUIRED is set. To stop this happening, Varnish should be # configured to not strip cookies if the cookie_passthrough param is # present, which this line ensures will be if LOGIN_REQUIRED is set. - my $extra = (FixMyStreet->config('LOGIN_REQUIRED')) ? "&cookie_passthrough=1" : ""; + my $extra = ''; + if (FixMyStreet->config('LOGIN_REQUIRED')) { + $cachebust .= '&cookie_passthrough=1'; + $extra = '?cookie_passthrough=1'; + } my ($hash, $format) = split /\./, $_; { id => $hash, url_temp => "/photo/temp.$hash.$format$extra", url_temp_full => "/photo/fulltemp.$hash.$format$extra", - url => "/photo/$id.$i.$format?$cachebust$extra", - url_full => "/photo/$id.$i.full.$format?$cachebust$extra", - url_tn => "/photo/$id.$i.tn.$format?$cachebust$extra", - url_fp => "/photo/$id.$i.fp.$format?$cachebust$extra", + url => "/photo/$id.$i.$format?$cachebust", + url_full => "/photo/$id.$i.full.$format?$cachebust", + url_tn => "/photo/$id.$i.tn.$format?$cachebust", + url_fp => "/photo/$id.$i.fp.$format?$cachebust", idx => $i++, } } $photoset->all_ids; |