Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nick Thomas
pleroma
Commits
c426a5d9
Commit
c426a5d9
authored
6 years ago
by
dtluna
Browse files
Options
Downloads
Patches
Plain Diff
Change @link_regex to match any URL scheme
parent
fef8daa4
Branches
feature/update-url-regex
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/pleroma/formatter.ex
+1
-1
1 addition, 1 deletion
lib/pleroma/formatter.ex
test/formatter_test.exs
+9
-0
9 additions, 0 deletions
test/formatter_test.exs
with
10 additions
and
1 deletion
lib/pleroma/formatter.ex
+
1
−
1
View file @
c426a5d9
...
...
@@ -144,7 +144,7 @@ defmodule Pleroma.Formatter do
@emoji
end
@link_regex
~r/
https?
:\/
\
/
[\
w
\
.
\
/
?=
\
-
#\+%&@~\(\):]+[\w\/]/u
@link_regex
~r/
[a-z0-9]+
:\/
\
/
[\
w
\
.
\
/
?=
\
-
#\+%&@~\(\):]+[\w\/]/u
def
html_escape
(
text
)
do
Regex
.
split
(
@link_regex
,
text
,
include_captures:
true
)
...
...
This diff is collapsed.
Click to expand it.
test/formatter_test.exs
+
9
−
0
View file @
c426a5d9
...
...
@@ -71,6 +71,15 @@ defmodule Pleroma.FormatterTest do
"<a href='https://www.google.co.jp/search?q=Nasim+Aghdam'>https://www.google.co.jp/search?q=Nasim+Aghdam</a>"
assert
Formatter
.
add_links
({[],
text
})
|>
Formatter
.
finalize
()
==
expected
text
=
"mumble://voluntaryism.club"
expected
=
"<a href='mumble://voluntaryism.club'>mumble://voluntaryism.club</a>"
assert
Formatter
.
add_links
({[],
text
})
|>
Formatter
.
finalize
()
==
expected
text
=
"xmpp://voluntaryism.club"
expected
=
"<a href='xmpp://voluntaryism.club'>xmpp://voluntaryism.club</a>"
assert
Formatter
.
add_links
({[],
text
})
|>
Formatter
.
finalize
()
==
expected
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment