Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions source/webinterface.d
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,16 @@ class WebInterface
string user = "";
auto location = URL(res.headers.get("Location", "https://gist.github.com/run-dlang")).path.bySegment;
if (!location.empty)
user = location.front.name;
{
auto first_loc = location.front.name;
// skip first slash from path
if (first_loc.empty) {
location.popFront();
user = location.front.name;
} else {
user = first_loc;
}
}

getGist(user, _gist);
}
Expand All @@ -296,14 +305,14 @@ class WebInterface
void getGist(string _user, string _gist)
{
import std.base64;
auto sourceCode = requestHTTP("https://gist.githubusercontent.com/%s/%s/raw".format(_user, _gist))
.bodyReader
.readAllUTF8;
showEditor(Base64.encode(sourceCode.representation));
auto sourceCode = requestHTTP("https://gist.githubusercontent.com/%s/%s/raw".format(_user, _gist))
.bodyReader
.readAllUTF8;
showEditor(Base64.encode(sourceCode.representation));
}

void showEditor(string sourceCode) {
string googleAnalyticsId = googleAnalyticsId_;
string googleAnalyticsId = googleAnalyticsId_;
const title = "Online D Editor";
const chapterId = "";
const language = "en";
Expand Down