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

Allow use of file:// urls in repos during development. #4801

Merged
merged 3 commits into from Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -17,3 +17,4 @@ exclude_lines =
pragma: no cover
raise NotImplementedError
if __name__ == .__main__.:
if getattr(settings, 'DEBUG'):
3 changes: 3 additions & 0 deletions readthedocs/projects/validators.py
Expand Up @@ -62,9 +62,12 @@ def __call__(self, value):
allow_private_repos = getattr(settings, 'ALLOW_PRIVATE_REPOS', False)
public_schemes = ['https', 'http', 'git', 'ftps', 'ftp']
private_schemes = ['ssh', 'ssh+git']
local_schemes = ['file']
valid_schemes = public_schemes
if allow_private_repos:
valid_schemes += private_schemes
if getattr(settings, 'DEBUG'): # allow `file://` urls in dev
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I use git daemon for local dev

Neat.

valid_schemes += local_schemes
url = urlparse(value)

# Malicious characters go first
Expand Down