summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb8
-rw-r--r--app/helpers/gitlab_markdown_helper.rb9
2 files changed, 12 insertions, 5 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e45f4650309..f65c5335a62 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -51,7 +51,13 @@ module ApplicationHelper
end
def project_icon(project_id, options = {})
- project = Project.find_with_namespace(project_id)
+ project =
+ if project_id.is_a?(Project)
+ project = project_id
+ else
+ Project.find_with_namespace(project_id)
+ end
+
if project.avatar.present?
image_tag project.avatar.url, options
elsif project.avatar_in_git
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index 800cacdc2c2..ab30f498c01 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -110,7 +110,7 @@ module GitlabMarkdownHelper
end
def link_to_ignore?(link)
- if link =~ /\#\w+/
+ if link =~ /\A\#\w+/
# ignore anchors like <a href="#my-header">
true
else
@@ -122,10 +122,11 @@ module GitlabMarkdownHelper
["http://","https://", "ftp://", "mailto:"]
end
- def rebuild_path(path)
- path.gsub!(/(#.*)/, "")
+ def rebuild_path(file_path)
+ file_path = file_path.dup
+ file_path.gsub!(/(#.*)/, "")
id = $1 || ""
- file_path = relative_file_path(path)
+ file_path = relative_file_path(file_path)
file_path = sanitize_slashes(file_path)
[