validate url
This commit is contained in:
@@ -6,7 +6,9 @@ class TemplatesUploadsController < ApplicationController
|
||||
layout 'plain'
|
||||
|
||||
def show
|
||||
redirect_to root_path if params[:url].blank?
|
||||
url_uri = Addressable::URI.parse(params[:url].to_s)
|
||||
|
||||
redirect_to root_path if url_uri.normalized_scheme != 'https' || url_uri.host.blank?
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<% path_uri = Addressable::URI.parse(params[:path].to_s) %>
|
||||
<% path = url_for(**Rails.application.routes.recognize_path(path_uri.path, method: :get)) %>
|
||||
<%= render 'shared/turbo_modal', title: local_assigns[:title] do %>
|
||||
<%= form_for '', url: params[:path], method: :get, data: { turbo_frame: :_top }, html: { autocomplete: :off } do |f| %>
|
||||
<%= form_for '', url: path, method: :get, data: { turbo_frame: :_top }, html: { autocomplete: :off } do |f| %>
|
||||
<%= hidden_field_tag :q, params[:q] if params[:q].present? %>
|
||||
<% local_assigns[:default_params].each do |key, value| %>
|
||||
<%= hidden_field_tag(key, value) if value.present? %>
|
||||
@@ -10,7 +12,7 @@
|
||||
</div>
|
||||
<% if params[:with_remove] %>
|
||||
<div class="text-center w-full mt-4">
|
||||
<%= link_to t('remove_filter'), "#{params[:path]}?#{request.query_parameters.slice('q').merge(local_assigns[:default_params]).to_query}", class: 'link', data: { turbo_frame: :_top } %>
|
||||
<%= link_to t('remove_filter'), "#{path}?#{request.query_parameters.slice('q').merge(local_assigns[:default_params]).to_query}", class: 'link', data: { turbo_frame: :_top } %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user