]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/5470'
authorTom Hughes <tom@compton.nu>
Sun, 5 Jan 2025 16:17:20 +0000 (16:17 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 5 Jan 2025 16:17:20 +0000 (16:17 +0000)
app/controllers/application_controller.rb
app/controllers/diary_comments_controller.rb
app/controllers/messages_controller.rb
test/controllers/diary_comments_controller_test.rb
test/controllers/messages_controller_test.rb
test/controllers/users_controller_test.rb

index 32b53bad71c3f431d79234d65e354f6cafcf13c9..1ef49bf4629c209a6e14a61c3fc97656c5405420 100644 (file)
@@ -20,7 +20,7 @@ class ApplicationController < ActionController::Base
   helper_method :oauth_token
 
   def self.allow_thirdparty_images(**options)
-    content_security_policy(options) do |policy|
+    content_security_policy(**options) do |policy|
       policy.img_src("*", :data)
     end
   end
index f6597cf4c0fac1f74fa69a2c12b9851fdc6ab4ad..676bc22a66a10306f1fc8c5f7628d40c5e7baee5 100644 (file)
@@ -13,7 +13,7 @@ class DiaryCommentsController < ApplicationController
   before_action :lookup_user, :only => :index
   before_action :check_database_writable, :only => [:create, :hide, :unhide]
 
-  allow_thirdparty_images :only => :index
+  allow_thirdparty_images :only => [:index, :create]
 
   def index
     @title = t ".title", :user => @user.display_name
index 26e8a5e09e6602d3a27508b8fb42a3d70b3acd5c..cc5f6c56d19dd4a6481534bc082eace36fa403ef 100644 (file)
@@ -49,7 +49,7 @@ class MessagesController < ApplicationController
     elsif @message.save
       flash[:notice] = t ".message_sent"
       UserMailer.message_notification(@message).deliver_later if @message.notify_recipient?
-      redirect_to messages_inbox_path
+      redirect_to messages_outbox_path
     else
       @title = t "messages.new.title"
       render :action => "new"
index 65a71a9b57b05d8f4eda9c53a4f535d143d270b5..3ea9bc09400d5334d3a80044d68089736591b427 100644 (file)
@@ -104,6 +104,7 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest
     end
     assert_response :success
     assert_template :new
+    assert_match(/img-src \* data:;/, @response.headers["Content-Security-Policy-Report-Only"])
 
     # Now try again with the right id
     assert_difference "ActionMailer::Base.deliveries.size", entry.subscribers.count do
index 9249908929426d32086ee4297f41d1cacf6198e1..b2bb71b1c71e8b1484983d9956f89487b55d5d21 100644 (file)
@@ -163,7 +163,7 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
         end
       end
     end
-    assert_redirected_to messages_inbox_path
+    assert_redirected_to messages_outbox_path
     assert_equal "Message sent", flash[:notice]
     e = ActionMailer::Base.deliveries.first
     assert_equal [recipient_user.email], e.to
index ba1af9509e0fbfaff740a279668f9aa4d247976c..7b554711f6e7dc28f52e4d695817332aba618d65 100644 (file)
@@ -57,6 +57,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
     get user_new_path, :params => { :cookie_test => "true" }
     assert_response :success
 
+    assert_no_match(/img-src \* data:;/, @response.headers["Content-Security-Policy-Report-Only"])
+
     assert_select "html", :count => 1 do
       assert_select "head", :count => 1 do
         assert_select "title", :text => /Sign Up/, :count => 1
@@ -297,6 +299,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
 
     get user_path(user)
     assert_response :success
+    assert_match(/img-src \* data:;/, @response.headers["Content-Security-Policy-Report-Only"])
     assert_select "div.content-heading" do
       assert_select "a[href^='/user/#{ERB::Util.u(user.display_name)}/history']", 1
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/traces']", 1