Commit cd62616e98be44029abca46164f42dd4bd48353f
1 parent
e3b70593
Exists in
master
and in
27 other branches
noosfero_urls: skip standard HTTP/HTTPS ports
Showing
1 changed file
with
9 additions
and
1 deletions
Show diff stats
config/initializers/noosfero_urls.rb
| 1 | if Rails.env == 'development' | 1 | if Rails.env == 'development' |
| 2 | ActionController::Base.send(:prepend_before_filter) do |controller| | 2 | ActionController::Base.send(:prepend_before_filter) do |controller| |
| 3 | - Noosfero.instance_variable_set('@development_url_options', { :port => controller.request.port }) | 3 | + # XXX note that this is not thread-safe! Accessing a Noosfero instance in |
| 4 | + # development mode under different ports concurrently _will_ lead to weird | ||
| 5 | + # things happening. | ||
| 6 | + if [80,443].include?(controller.request.port) | ||
| 7 | + url_options = {} | ||
| 8 | + else | ||
| 9 | + url_options = { :port => controller.request.port } | ||
| 10 | + end | ||
| 11 | + Noosfero.instance_variable_set('@development_url_options', url_options) | ||
| 4 | end | 12 | end |
| 5 | end | 13 | end |