@@ -152,7 +152,8 @@ class GitHubDrive implements Contents.IDrive {
152
152
// appropriate resource.
153
153
const repo = path . split ( '/' ) [ 0 ] ;
154
154
const repoPath = URLExt . join ( ...path . split ( '/' ) . slice ( 1 ) ) ;
155
- const apiPath = URLExt . join ( 'repos' , this . _user , repo , 'contents' , repoPath ) ;
155
+ const apiPath = URLExt . encodeParts (
156
+ URLExt . join ( 'repos' , this . _user , repo , 'contents' , repoPath ) ) ;
156
157
return this . _apiRequest < GitHubContents > ( apiPath ) . then ( contents => {
157
158
// Set the states
158
159
this . validUserState . set ( true ) ;
@@ -210,7 +211,8 @@ class GitHubDrive implements Contents.IDrive {
210
211
const repo = path . split ( '/' ) [ 0 ] ;
211
212
const repoPath = URLExt . join ( ...path . split ( '/' ) . slice ( 1 ) ) ;
212
213
const dirname = PathExt . dirname ( repoPath ) ;
213
- const dirApiPath = URLExt . join ( 'repos' , this . _user , repo , 'contents' , dirname ) ;
214
+ const dirApiPath = URLExt . encodeParts (
215
+ URLExt . join ( 'repos' , this . _user , repo , 'contents' , dirname ) ) ;
214
216
return this . _apiRequest < GitHubDirectoryListing > ( dirApiPath ) . then ( dirContents => {
215
217
for ( let item of dirContents ) {
216
218
if ( item . path === repoPath ) {
@@ -346,7 +348,8 @@ class GitHubDrive implements Contents.IDrive {
346
348
const repo = path . split ( '/' ) [ 0 ] ;
347
349
const repoPath = URLExt . join ( ...path . split ( '/' ) . slice ( 1 ) ) ;
348
350
const dirname = PathExt . dirname ( repoPath ) ;
349
- const dirApiPath = URLExt . join ( 'repos' , this . _user , repo , 'contents' , dirname ) ;
351
+ const dirApiPath = URLExt . encodeParts (
352
+ URLExt . join ( 'repos' , this . _user , repo , 'contents' , dirname ) ) ;
350
353
return this . _apiRequest < GitHubDirectoryListing > ( dirApiPath ) . then ( dirContents => {
351
354
for ( let item of dirContents ) {
352
355
if ( item . path === repoPath ) {
@@ -357,8 +360,8 @@ class GitHubDrive implements Contents.IDrive {
357
360
throw Error ( 'Cannot find sha for blob' ) ;
358
361
} ) . then ( sha => {
359
362
//Once we have the sha, form the api url and make the request.
360
- const blobApiPath = URLExt . join (
361
- 'repos' , this . _user , repo , 'git' , 'blobs' , sha ) ;
363
+ const blobApiPath = URLExt . encodeParts ( URLExt . join (
364
+ 'repos' , this . _user , repo , 'git' , 'blobs' , sha ) ) ;
362
365
return this . _apiRequest < GitHubBlob > ( blobApiPath ) ;
363
366
} ) . then ( blob => {
364
367
//Convert the data to a Contents.IModel.
@@ -374,7 +377,8 @@ class GitHubDrive implements Contents.IDrive {
374
377
private _listRepos ( ) : Promise < Contents . IModel > {
375
378
return new Promise < Contents . IModel > ( ( resolve , reject ) => {
376
379
// Try to find it under orgs.
377
- const apiPath = URLExt . join ( 'users' , this . _user , 'repos' ) ;
380
+ const apiPath = URLExt . encodeParts (
381
+ URLExt . join ( 'users' , this . _user , 'repos' ) ) ;
378
382
this . _apiRequest < GitHubRepo [ ] > ( apiPath ) . then ( repos => {
379
383
this . validUserState . set ( true ) ;
380
384
this . rateLimitedState . set ( false ) ;
0 commit comments