-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support "file:///" as hyperlink #508
Changes from all commits
00fad85
bcddd2a
e8536ed
131650d
c25c0ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,11 @@ def replaced(payload, url, phrase=''): | |
converted = bugdown_convert(inline_url) | ||
self.assertEqual(match, converted) | ||
|
||
def test_inline_file(self): | ||
msg = 'Check out this file file:///Volumes/myserver/Users/Shared/pi.py' | ||
converted = bugdown_convert(msg) | ||
self.assertEqual(converted, '<p>Check out this file <a href="file:///Volumes/myserver/Users/Shared/pi.py" target="_blank" title="file:///Volumes/myserver/Users/Shared/pi.py">file:///Volumes/myserver/Users/Shared/pi.py</a></p>') | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it'd be good to have tests for correct behavior with both https://docs.djangoproject.com/en/dev/topics/testing/tools/#overriding-settings is probably relevant for how to write such tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the slow reply!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think what's going on is effectively a form of caching -- the bugdown library only is initialized once per realm and the code involved is initialization code. See |
||
def test_inline_youtube(self): | ||
msg = 'Check out the debate: http://www.youtube.com/watch?v=hx1mjT73xYE' | ||
converted = bugdown_convert(msg) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,10 @@ | |
# a link to an image is referenced in a message. | ||
INLINE_IMAGE_PREVIEW = True | ||
|
||
# Controls whether or not Zulip will parse links starting with | ||
# "file:///" as a hyperlink. | ||
ENABLE_FILE_LINKS = False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe expand this comment a bit more to discuss the use case, e.g.
|
||
|
||
# By default, files uploaded by users and user avatars are stored | ||
# directly on the Zulip server. If file storage in Amazon S3 is | ||
# desired, you can configure that as follows: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,7 @@ def get_secret(key): | |
'REMOTE_POSTGRES_SSLMODE': '', | ||
'GOOGLE_CLIENT_ID': '', | ||
'DBX_APNS_CERT_FILE': None, | ||
'ENABLE_FILE_LINKS' : False, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should also add a patch to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool, looks like you did this one. |
||
} | ||
|
||
for setting_name, setting_val in DEFAULT_SETTINGS.iteritems(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm probably this
or
case should be conditional onsettings.ENABLE_FILE_LINKS
as well, right?