summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChang-Hung Liang <eliang.cs@gmail.com>2017-05-11 20:15:15 +0800
committerGitHub <noreply@github.com>2017-05-11 20:15:15 +0800
commit1eb8b45de48eda59bb78bf1fef5cb2c9278765b9 (patch)
treeda4d41f4bb4cacf7e2140463a4bbda361ac71dc3
parentcb963867e816766057281e53bff60340b53bc05c (diff)
parentb14fe5d43502f46301da249a09f7d8f8e55a4db9 (diff)
Merge pull request #117 from eliangcs/issue/116-windows-spec-path
Fix #116: --spec local path issue on Windows
-rw-r--r--http_prompt/cli.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/http_prompt/cli.py b/http_prompt/cli.py
index c4cc6f2..01e5a3e 100644
--- a/http_prompt/cli.py
+++ b/http_prompt/cli.py
@@ -2,6 +2,7 @@ from __future__ import unicode_literals
import json
import os
+import re
import sys
import click
@@ -16,8 +17,7 @@ from prompt_toolkit.styles.from_pygments import style_from_pygments
from pygments.styles import get_style_by_name
from pygments.util import ClassNotFound
from six.moves.http_cookies import SimpleCookie
-from six.moves.urllib.parse import urlparse
-from six.moves.urllib.request import urlopen
+from six.moves.urllib.request import urlopen, pathname2url
from . import __version__
from . import config
@@ -75,8 +75,8 @@ class ExecutionListener(object):
def normalize_url(ctx, param, value):
if value:
- if not urlparse(value).scheme:
- value = 'file://' + os.path.abspath(value)
+ if not re.search(r'^\w+://', value):
+ value = 'file:' + pathname2url(os.path.abspath(value))
return value
return None