diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-10 18:30:02 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-10 18:31:07 +0200 |
commit | 0ece6bd82839d0c9e3e27b65a6a201771f09190e (patch) | |
tree | 40c877c8377f2bcad111de9e3bdf0daabdb0c3a3 /app/helpers | |
parent | 6cf7dd625a7db143c146de1b146cba7dbcbc2576 (diff) | |
download | gitlab-ce-0ece6bd82839d0c9e3e27b65a6a201771f09190e.tar.gz |
Use `\A` and `\z` in regexes instead of `^` and `$`.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/submodule_helper.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3f3509bb18a..b5b0015542c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -125,7 +125,7 @@ module ApplicationHelper # If reference is commit id - we should add it to branch/tag selectbox if(@ref && !options.flatten.include?(@ref) && - @ref =~ /^[0-9a-zA-Z]{6,52}$/) + @ref =~ /\A[0-9a-zA-Z]{6,52}\z/) options << ['Commit', [@ref]] end diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 17266656a4e..aa1de2f50ef 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -13,7 +13,7 @@ module GitlabMarkdownHelper def link_to_gfm(body, url, html_options = {}) return "" if body.blank? - escaped_body = if body =~ /^\<img/ + escaped_body = if body =~ /\A\<img/ body else escape_once(body) @@ -139,7 +139,7 @@ module GitlabMarkdownHelper @project.path_with_namespace, path_with_ref(file_path), file_path - ].compact.join("/").gsub(/^\/*|\/*$/, '') + id + ].compact.join("/").gsub(/\A\/*|\/*\z/, '') + id end def sanitize_slashes(path) diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 241462e5e4c..48aa1eda67d 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -44,7 +44,7 @@ module SubmoduleHelper def relative_self_url?(url) # (./)?(../repo.git) || (./)?(../../project/repo.git) ) - url =~ /^((\.\/)?(\.\.\/))(?!(\.\.)|(.*\/)).*\.git\Z/ || url =~ /^((\.\/)?(\.\.\/){2})(?!(\.\.))([^\/]*)\/(?!(\.\.)|(.*\/)).*\.git\Z/ + url =~ /\A((\.\/)?(\.\.\/))(?!(\.\.)|(.*\/)).*\.git\z/ || url =~ /\A((\.\/)?(\.\.\/){2})(?!(\.\.))([^\/]*)\/(?!(\.\.)|(.*\/)).*\.git\z/ end def standard_links(host, namespace, project, commit) |