mirror of
https://github.com/criyle/go-judge.git
synced 2025-09-26 22:39:12 +08:00
rest: no copy file download
This commit is contained in:
parent
8025bd36b6
commit
c29d0adce2
@ -67,6 +67,15 @@ func (f *fileHandle) fileIDGet(c *gin.Context) {
|
||||
c.AbortWithStatus(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
typ := mime.TypeByExtension(path.Ext(name))
|
||||
c.Header("Content-Type", typ)
|
||||
|
||||
fi, ok := file.(*envexec.FileInput) // fast path
|
||||
if ok {
|
||||
c.FileAttachment(fi.Path, name)
|
||||
return
|
||||
}
|
||||
|
||||
r, err := envexec.FileToReader(file)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
@ -79,8 +88,6 @@ func (f *fileHandle) fileIDGet(c *gin.Context) {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
typ := mime.TypeByExtension(path.Ext(name))
|
||||
c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", name))
|
||||
c.Data(http.StatusOK, typ, content)
|
||||
}
|
||||
|
2
env/winc/environment_windows.go
vendored
2
env/winc/environment_windows.go
vendored
@ -251,7 +251,7 @@ func (e *Environment) Execve(ctx context.Context, param envexec.ExecveParam) (pr
|
||||
result.ExitStatus = int(exitCode)
|
||||
|
||||
// collect usage
|
||||
t, m, err := getJobOjbectUsage(hJob)
|
||||
t, m, err := getJobObjectUsage(hJob)
|
||||
if err != nil {
|
||||
procSet.result = runner.Result{Status: runner.StatusRunnerError, Error: err.Error()}
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user