Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Conversation

kevchentw
Copy link
Contributor

fixed #380

Add the support of file:/// as hyperlink. It is default to be off.
Enable by setting ENABLE_FILE_LINKS = True in zproject/settings.py
Notice that the browser will block the link start with file:/// and need to install extension to fix it.

@smarx
Copy link

smarx commented Mar 10, 2016

Automated message from Dropbox CLA bot

@kevchentw, it looks like you've already signed the Dropbox CLA. Thanks!

@kevchentw kevchentw closed this Mar 10, 2016
@kevchentw kevchentw reopened this Mar 10, 2016
@kevchentw
Copy link
Contributor Author

Travis CI seems to failed often?

@timabbott
Copy link
Sponsor Member

Travis CI is having some issues with its apt mirrors, and thus everyone's Travis CI builds are failing somewhat often right now. For Zulip it's mostly the "production" tests, which tests the dependencies and installation process, since that makes heavy use of apt...

@kevchentw
Copy link
Contributor Author

Should I reopened the pr to run the CI again?

@@ -634,7 +634,6 @@ def sanitize_url(url):
except ValueError:
# Bad url - so bad it couldn't be parsed.
return ''

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should remove this whitespace change from the commit.

@timabbott
Copy link
Sponsor Member

Well, this change needs tests for the new behavior, so why don't you add those, and when you push your updates to add tests, it'll rerun the CI anyway.

@timabbott
Copy link
Sponsor Member

(tests probably belong in zerver/test_bugdown.py)

@@ -159,6 +159,7 @@ def get_secret(key):
'REMOTE_POSTGRES_SSLMODE': '',
'GOOGLE_CLIENT_ID': '',
'DBX_APNS_CERT_FILE': None,
'ENABLE_FILE_LINKS' : False,
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also add a patch to zproject/local_settings_template.py documenting the feature and providing a clear place to set this new setting.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, looks like you did this one.

@timabbott timabbott mentioned this pull request Mar 19, 2016
@@ -999,7 +999,7 @@ def content_has_image(content):

@staticmethod
def content_has_link(content):
return 'http://' in content or 'https://' in content or '/user_uploads' in content
return 'http://' in content or 'https://' in content or '/user_uploads' in content or 'file:///' in content
Copy link
Sponsor Member

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 on settings.ENABLE_FILE_LINKS as well, right?

@timabbott
Copy link
Sponsor Member

Thanks @kevchentw, and sorry for the slow review! I posted a couple more comments on this, and also asked the original reporter to take a look and see if this does what they want.

Finally, you should squash the commits to match the Zulip commit style (http://zulip.readthedocs.org/en/latest/code-style.html#version-control)

Oh, and update the commit message summary to make clear this is a new setting.

@@ -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
Copy link
Sponsor Member

Choose a reason for hiding this comment

The 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.

# Controls whether or not Zulip will parse links starting with
# "file:///" as a hyperlink (useful if you have e.g. an NFS share).

@timabbott
Copy link
Sponsor Member

@kevchentw just wanted to follow up on this pull request!

@brainwane
Copy link
Contributor

@kevchentw How is this pull request going? Are there questions you'd perhaps like to talk about in realtime? We could chat about it during our office hours on October 3rd.

@timabbott
Copy link
Sponsor Member

This was merged as #2216.

@timabbott timabbott closed this Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File links in Zulip
4 participants