Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 416b3c9

Browse files
authored
Allow spaces in file names
Closes #18?
1 parent 1f443b8 commit 416b3c9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

apis/github

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ local function getAPI(path, auth)
1515
end
1616
end
1717

18+
local function encodeURI(s)
19+
return s:replace(' ', '%20')
20+
end
21+
1822
-- A class for authorization
1923
local authFile = '.github-auth'
2024
local function writeAuth(data)
@@ -136,8 +140,10 @@ Tree.cloneTo = function(self, dest, onProgress)
136140
fs.makeDir(path)
137141
elseif getmetatable(item) == Blob then
138142
local data = http.get(
139-
('https://raw.github.com/%s/%s/%s/%s')
140-
:format(self.repo.user, self.repo.name, self.sha, gitpath)
143+
('https://raw.github.com/%s/%s/%s/%s'):format(
144+
self.repo.user, self.repo.name, self.sha,
145+
encodeURI(gitpath)
146+
)
141147
)
142148
local h = fs.open(path, 'w')
143149
local text = data.readAll()

0 commit comments

Comments
 (0)