Skip to content

Commit

Permalink
Fix #116: --spec local path issue on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
eliangcs committed May 10, 2017
1 parent 56448cd commit b14fe5d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions http_prompt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import json
import os
import re
import sys

import click
Expand All @@ -16,8 +17,7 @@
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
Expand Down Expand Up @@ -75,8 +75,8 @@ def response_returned(self, context, response):

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

Expand Down

0 comments on commit b14fe5d

Please sign in to comment.