Skip to content
This repository was archived by the owner on Jul 2, 2022. It is now read-only.

Commit c91fe9b

Browse files
committed
Fixed Issue with Hash Character in directory name
Fixes #488
1 parent e6b6f5b commit c91fe9b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CodeHub.iOS/ViewControllers/Source/AddSourceViewController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ private async Task CommitThis(string message)
109109
UIApplication.SharedApplication.BeginIgnoringInteractionEvents();
110110
NetworkActivity.PushNetworkActive();
111111

112+
var encodedPath = path == null ? null : System.Net.WebUtility.UrlEncode(path);
113+
112114
var result = await _applicationService.GitHubClient.Repository.Content.CreateFile(
113-
_username, _repository, path, new Octokit.CreateFileRequest(message, content, _branch));
115+
_username, _repository, encodedPath, new Octokit.CreateFileRequest(message, content, _branch));
114116

115117
this.PresentingViewController?.DismissViewController(true, null);
116118

CodeHub.iOS/ViewControllers/Source/FileSourceViewController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ private async Task Load(CancellationToken cancelToken)
131131

132132
if (Content == null)
133133
{
134-
var encodedShaRef = System.Web.HttpUtility.UrlEncode(_sha);
134+
var encodedShaRef = System.Net.WebUtility.UrlEncode(_sha);
135+
var encodedPath = _path == null ? null : System.Net.WebUtility.UrlEncode(_path);
135136

136137
var items = await _applicationService
137138
.GitHubClient.Repository.Content
138-
.GetAllContentsByRef(_username, _repository, _path, encodedShaRef);
139+
.GetAllContentsByRef(_username, _repository, encodedPath, encodedShaRef);
139140
Content = items.First();
140141
}
141142

CodeHub.iOS/ViewControllers/Source/SourceTreeViewController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ public SourceTreeViewController(
8888
.GetAllContentsByRef(username, repository, encodedShaRef);
8989
}
9090

91+
var encodedPath = path == null ? null : System.Net.WebUtility.UrlEncode(path);
92+
9193
return await applicationService
9294
.GitHubClient.Repository.Content
93-
.GetAllContentsByRef(username, repository, path, encodedShaRef);
95+
.GetAllContentsByRef(username, repository, encodedPath, encodedShaRef);
9496
});
9597

9698
var addFileButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);

0 commit comments

Comments
 (0)