Skip to content

Commit

Permalink
Merge pull request ruifm#55
Browse files Browse the repository at this point in the history
fix: decode space char before extracting repo path
  • Loading branch information
ruifm authored Jun 28, 2022
2 parents af7567c + 0af1fb2 commit 782e98d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/gitlinker/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ end
local function parse_repo_path(stripped_uri, host, port, errs)
assert(host)

local pathChars = "[~/_%-%w%.]+"
local pathChars = "[~/_%-%w%.%s]+"
-- base of path capture
local path_capture = "[:/](" .. pathChars .. ")$"

Expand All @@ -125,7 +125,10 @@ local function parse_repo_path(stripped_uri, host, port, errs)
path_capture = allowed_chars .. path_capture

-- parse repo path
local repo_path = stripped_uri:match(path_capture)
local repo_path = stripped_uri
:gsub("%%20", " ") -- decode the space character
:match(path_capture)
:gsub(" ", "%%20") -- encode the space character
if not repo_path then
table.insert(
errs,
Expand Down

0 comments on commit 782e98d

Please sign in to comment.