feat(alias): support proxy and direct together

This commit is contained in:
Andy Hsu
2023-03-14 13:38:41 +08:00
parent c4108007cd
commit d9795ff22f
6 changed files with 68 additions and 20 deletions

View File

@ -2,6 +2,7 @@ package handles
import (
"fmt"
"io"
stdpath "path"
"regexp"
@ -15,6 +16,7 @@ import (
"github.com/alist-org/alist/v3/server/common"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
type MkdirOrLinkReq struct {
@ -379,6 +381,14 @@ func Link(c *gin.Context) {
common.ErrorResp(c, err, 500)
return
}
if link.Data != nil {
defer func(Data io.ReadCloser) {
err := Data.Close()
if err != nil {
log.Errorf("close link data error: %v", err)
}
}(link.Data)
}
common.SuccessResp(c, link)
return
}