Skip to content

Commit 8bec393

Browse files
committed
Handle symlinks on submit
1 parent 6834f6c commit 8bec393

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

api/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type PayloadSubmission struct {
3838
// from the x-api, but it is also used when restoring earlier iterations.
3939
func Fetch(url string) ([]*Problem, error) {
4040
req, err := http.NewRequest("GET", url, nil)
41+
fmt.Println(url)
4142
if err != nil {
4243
return nil, err
4344
}

handlers/submit.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ func Submit(ctx *cli.Context) {
4141
log.Fatal(err)
4242
}
4343

44+
dir, err := filepath.EvalSymlinks(c.Dir)
45+
if err != nil {
46+
log.Fatal(err)
47+
}
48+
4449
code, err := ioutil.ReadFile(path)
4550
if err != nil {
4651
log.Fatalf("Cannot read the contents of %s - %s\n", filename, err)
@@ -51,7 +56,7 @@ func Submit(ctx *cli.Context) {
5156
iteration := &api.Iteration{
5257
Key: c.APIKey,
5358
Code: string(code),
54-
Path: path[len(c.Dir):],
59+
Path: path[len(dir):],
5560
Dir: c.Dir,
5661
}
5762

0 commit comments

Comments
 (0)