Skip to content

Commit

Permalink
Fix: use urllib.urlencode for branch names containing hash tag
Browse files Browse the repository at this point in the history
  • Loading branch information
randy3k committed Mar 5, 2018
1 parent 4ba9966 commit 4413118
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions github/commands/pull_request.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sublime
from sublime_plugin import WindowCommand
from webbrowser import open as open_in_browser
import urllib

from ...core.git_command import GitCommand
from ...core.ui_mixins.quick_panel import show_paginated_panel
Expand Down Expand Up @@ -187,13 +188,13 @@ def open_comparision_in_browser(self, owner, branch):
base_owner = base_remote.owner
base_branch = self.get_integrated_branch_name()

open_in_browser("{}/compare/{}:{}...{}:{}?expand=1".format(
open_in_browser(urllib.urlencode("{}/compare/{}:{}...{}:{}?expand=1".format(
url,
base_owner,
base_branch,
owner,
branch
))
)))


class GsGithubPushAndCreatePullRequestCommand(GsPushToBranchNameCommand):
Expand Down
3 changes: 2 additions & 1 deletion github/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from collections import namedtuple
from webbrowser import open as open_in_browser
from functools import partial
import urllib

import sublime

Expand Down Expand Up @@ -95,7 +96,7 @@ def open_file_in_browser(rel_path, remote, commit_hash, start_line=None, end_lin
lines=line_numbers
)

open_in_browser(url)
open_in_browser(urllib.urlencode(url))


def open_repo(remote):
Expand Down
5 changes: 3 additions & 2 deletions gitlab/commands/merge_request.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sublime
from sublime_plugin import WindowCommand
from webbrowser import open as open_in_browser
# import urllib

from ...core.git_command import GitCommand
from ...core.ui_mixins.quick_panel import show_paginated_panel
Expand Down Expand Up @@ -173,13 +174,13 @@ def open_mr_in_browser(self):
# base_owner = base_remote.owner
# base_branch = self.get_integrated_branch_name()

# open_in_browser("{}/compare/{}:{}...{}:{}?expand=1".format(
# open_in_browser(urllib.urlencode("{}/compare/{}:{}...{}:{}?expand=1".format(
# url,
# base_owner,
# base_branch,
# owner,
# branch
# ))
# )))


# class GsPushAndCreateMergeRequestCommand(GsPushToBranchNameCommand):
Expand Down
3 changes: 2 additions & 1 deletion gitlab/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from collections import namedtuple
from functools import partial, lru_cache
from webbrowser import open as open_in_browser
import urllib

import sublime

Expand Down Expand Up @@ -97,7 +98,7 @@ def open_file_in_browser(rel_path, remote, commit_hash, start_line=None, end_lin
lines=line_numbers
)

open_in_browser(url)
open_in_browser(urllib.urlencode(url))


def open_repo(remote):
Expand Down

0 comments on commit 4413118

Please sign in to comment.