Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
99ee8228
Commit
99ee8228
authored
Mar 30, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method that returns markdown in file uploader
parent
e64b1e52
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
app/uploaders/file_uploader.rb
app/uploaders/file_uploader.rb
+4
-0
lib/gitlab/gfm/reference_rewriter.rb
lib/gitlab/gfm/reference_rewriter.rb
+1
-1
lib/gitlab/gfm/uploads_rewriter.rb
lib/gitlab/gfm/uploads_rewriter.rb
+1
-1
No files found.
app/uploaders/file_uploader.rb
View file @
99ee8228
...
@@ -32,6 +32,10 @@ class FileUploader < CarrierWave::Uploader::Base
...
@@ -32,6 +32,10 @@ class FileUploader < CarrierWave::Uploader::Base
File
.
join
(
"/uploads"
,
@secret
,
file
.
filename
)
File
.
join
(
"/uploads"
,
@secret
,
file
.
filename
)
end
end
def
to_markdown
to_h
[
:markdown
]
end
def
to_h
def
to_h
filename
=
image?
?
self
.
file
.
basename
:
self
.
file
.
filename
filename
=
image?
?
self
.
file
.
basename
:
self
.
file
.
filename
escaped_filename
=
filename
.
gsub
(
"]"
,
"
\\
]"
)
escaped_filename
=
filename
.
gsub
(
"]"
,
"
\\
]"
)
...
...
lib/gitlab/gfm/reference_rewriter.rb
View file @
99ee8228
...
@@ -46,7 +46,7 @@ module Gitlab
...
@@ -46,7 +46,7 @@ module Gitlab
end
end
def
needs_rewrite?
def
needs_rewrite?
!
(
@text
=~
@pattern
).
nil?
@text
=~
@pattern
end
end
private
private
...
...
lib/gitlab/gfm/uploads_rewriter.rb
View file @
99ee8228
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
return
markdown
unless
file
.
try
(
:exists?
)
return
markdown
unless
file
.
try
(
:exists?
)
new_uploader
.
store!
(
file
)
new_uploader
.
store!
(
file
)
new_uploader
.
to_
h
[
:markdown
]
new_uploader
.
to_
markdown
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment