Skip to content

Commit

Permalink
Handle symlinks on submit
Browse files Browse the repository at this point in the history
  • Loading branch information
kytrinyx committed Sep 26, 2014
1 parent 6834f6c commit 8bec393
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type PayloadSubmission struct {
// from the x-api, but it is also used when restoring earlier iterations.
func Fetch(url string) ([]*Problem, error) {
req, err := http.NewRequest("GET", url, nil)
fmt.Println(url)
if err != nil {
return nil, err
}
Expand Down
7 changes: 6 additions & 1 deletion handlers/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func Submit(ctx *cli.Context) {
log.Fatal(err)
}

dir, err := filepath.EvalSymlinks(c.Dir)
if err != nil {
log.Fatal(err)
}

code, err := ioutil.ReadFile(path)
if err != nil {
log.Fatalf("Cannot read the contents of %s - %s\n", filename, err)
Expand All @@ -51,7 +56,7 @@ func Submit(ctx *cli.Context) {
iteration := &api.Iteration{
Key: c.APIKey,
Code: string(code),
Path: path[len(c.Dir):],
Path: path[len(dir):],
Dir: c.Dir,
}

Expand Down

0 comments on commit 8bec393

Please sign in to comment.