Skip to content
Snippets Groups Projects
Select Git revision
  • 566e9ca8df4e93183bdc1be72fb8c80034dc15a0
  • master default
  • labcomm2006
  • typedefs
  • anders.blomdell
  • typeref
  • pragma
  • compiler-refactoring
  • labcomm2013
  • v2014.4
  • v2006.0
  • v2014.3
  • v2014.2
  • v2014.1
  • v2014.0
  • v2013.0
16 results

LabCommmTokens.jrag

Blame
  • Forked from Anders Blomdell / LabComm
    Source project has a limited visibility.
    xsendfile_patch.rb 1003 B
    module XsendfilePatch
      def self.included(base)
        base.send(:include, InstanceMethods)
        base.class_eval do
          alias_method_chain :send_file, :xsendfile
        end
      end
    
      module InstanceMethods
        def send_file_with_xsendfile(path, options = {})
          if params[:controller] == 'attachments'
            case Setting.plugin_redmine_xsendfile['mode']
            when 'nginx'
              options[:length]   ||= File.size(path)
              options[:filename] ||= File.basename(path) unless options[:url_based_filename]
              send_file_headers! options
              @performed_render = false
              xsendfile_path = path.gsub(/^#{Regexp.quote(Attachment.storage_path)}/, '/xsendfile')
              logger.info "Sending X-Accel-Redirect header #{xsendfile_path}" if logger
              head options[:status], 'X-Accel-Redirect' => xsendfile_path
            else
              send_file_without_xsendfile(path, options)
            end
          else
            send_file_without_xsendfile(path, options)
          end
        end
      end
    end