Merge remote-tracking branch 'origin/inified_404_error'

This commit is contained in:
Valery Sizov 2015-10-14 18:21:27 +03:00
commit 6c1faf4b33
15 changed files with 21 additions and 24 deletions

View file

@ -51,6 +51,7 @@ v 8.1.0 (unreleased)
- Project names are not fully shown if group name is too big, even on group page view
- Apply new design for Files page
- Add "New Page" button to Wiki Pages tab (Stan Hu)
- Only render 404 page from /public
v 8.0.4
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)

View file

@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base
rescue_from ActiveRecord::RecordNotFound do |exception|
log_exception(exception)
render "errors/not_found", layout: "errors", status: 404
render_404
end
protected
@ -149,10 +149,6 @@ class ApplicationController < ActionController::Base
render "errors/access_denied", layout: "errors", status: 404
end
def not_found!
render "errors/not_found", layout: "errors", status: 404
end
def git_not_found!
render "errors/git_not_found", layout: "errors", status: 404
end

View file

@ -62,7 +62,7 @@ class Import::BitbucketController < Import::BaseController
end
def verify_bitbucket_import_enabled
not_found! unless bitbucket_import_enabled?
render_404 unless bitbucket_import_enabled?
end
def bitbucket_auth

View file

@ -99,6 +99,6 @@ class Import::FogbugzController < Import::BaseController
end
def verify_fogbugz_import_enabled
not_found! unless fogbugz_import_enabled?
render_404 unless fogbugz_import_enabled?
end
end

View file

@ -47,7 +47,7 @@ class Import::GithubController < Import::BaseController
end
def verify_github_import_enabled
not_found! unless github_import_enabled?
render_404 unless github_import_enabled?
end
def github_auth

View file

@ -44,7 +44,7 @@ class Import::GitlabController < Import::BaseController
end
def verify_gitlab_import_enabled
not_found! unless gitlab_import_enabled?
render_404 unless gitlab_import_enabled?
end
def gitlab_auth

View file

@ -42,7 +42,7 @@ class Import::GitoriousController < Import::BaseController
end
def verify_gitorious_import_enabled
not_found! unless gitorious_import_enabled?
render_404 unless gitorious_import_enabled?
end
end

View file

@ -106,7 +106,7 @@ class Import::GoogleCodeController < Import::BaseController
end
def verify_google_code_import_enabled
not_found! unless google_code_import_enabled?
render_404 unless google_code_import_enabled?
end
def user_map

View file

@ -12,7 +12,7 @@ class Projects::AvatarsController < Projects::ApplicationController
filename: @blob.name
)
else
not_found!
render_404
end
end

View file

@ -113,14 +113,14 @@ class Projects::BlobController < Projects::ApplicationController
end
end
return not_found!
return render_404
end
end
def commit
@commit = @repository.commit(@ref)
return not_found! unless @commit
return render_404 unless @commit
end
def assign_blob_vars
@ -128,7 +128,7 @@ class Projects::BlobController < Projects::ApplicationController
@ref, @path = extract_ref(@id)
rescue InvalidPathError
not_found!
render_404
end
def after_edit_path

View file

@ -20,7 +20,7 @@ class Projects::RawController < Projects::ApplicationController
disposition: 'inline'
)
else
not_found!
render_404
end
end

View file

@ -10,7 +10,7 @@ class Projects::TreeController < Projects::ApplicationController
before_action :authorize_push_code!, only: [:create_dir]
def show
return not_found! unless @repository.commit(@ref)
return render_404 unless @repository.commit(@ref)
if tree.entries.empty?
if @repository.blob_at(@commit.id, @path)
@ -19,7 +19,7 @@ class Projects::TreeController < Projects::ApplicationController
File.join(@ref, @path))
) and return
elsif @path.present?
return not_found!
return render_404
end
end
@ -31,7 +31,7 @@ class Projects::TreeController < Projects::ApplicationController
end
def create_dir
return not_found! unless @commit_params.values.all?
return render_404 unless @commit_params.values.all?
begin
result = Files::CreateDirService.new(@project, current_user, @commit_params).execute

View file

@ -20,7 +20,7 @@ class Projects::UploadsController < Projects::ApplicationController
end
def show
return not_found! if uploader.nil? || !uploader.file.exists?
return render_404 if uploader.nil? || !uploader.file.exists?
disposition = uploader.image? ? 'inline' : 'attachment'
send_file uploader.file.path, disposition: disposition

View file

@ -10,7 +10,7 @@ class UploadsController < ApplicationController
end
unless uploader.file && uploader.file.exists?
return not_found!
return render_404
end
disposition = uploader.image? ? 'inline' : 'attachment'
@ -21,7 +21,7 @@ class UploadsController < ApplicationController
def find_model
unless upload_model && upload_mount
return not_found!
return render_404
end
@model = upload_model.find(params[:id])
@ -44,7 +44,7 @@ class UploadsController < ApplicationController
return if authorized
if current_user
not_found!
render_404
else
authenticate_user!
end

View file

@ -110,7 +110,7 @@ module ExtractsPath
@project, @ref, @path)
rescue RuntimeError, NoMethodError, InvalidPathError
not_found!
render_404
end
def tree