Merge remote-tracking branch 'origin/master'

pull/1324/head
HFO4 3 years ago
commit 21d2b817f4

@ -5,6 +5,7 @@ import (
"flag"
"io"
"io/fs"
"os"
"strings"
"github.com/cloudreve/Cloudreve/v3/bootstrap"
@ -67,6 +68,15 @@ func main() {
// 如果启用了Unix
if conf.UnixConfig.Listen != "" {
// delete socket file before listening
if _, err := os.Stat(conf.UnixConfig.Listen); err == nil {
if err = os.Remove(conf.UnixConfig.Listen); err != nil {
util.Log().Error("删除 socket 文件错误, %s", err)
return
}
}
api.TrustedPlatform = conf.UnixConfig.ProxyHeader
util.Log().Info("开始监听 %s", conf.UnixConfig.Listen)
if err := api.RunUnix(conf.UnixConfig.Listen); err != nil {
util.Log().Error("无法监听[%s]%s", conf.UnixConfig.Listen, err)

@ -36,6 +36,7 @@ type ssl struct {
type unix struct {
Listen string
ProxyHeader string `validate:"required_with=Listen"`
}
// slave 作为slave存储端配置

@ -46,6 +46,7 @@ var SSLConfig = &ssl{
var UnixConfig = &unix{
Listen: "",
ProxyHeader: "X-Forwarded-For",
}
var OptionOverwrite = map[string]interface{}{}

@ -10,7 +10,9 @@ import (
"encoding/xml"
"errors"
"fmt"
"mime"
"net/http"
"path/filepath"
"strconv"
"time"
@ -381,7 +383,7 @@ func findContentType(ctx context.Context, fs *filesystem.FileSystem, ls LockSyst
//// Rewind file.
//_, err = f.Seek(0, os.SEEK_SET)
//return ctype, err
return "", nil
return mime.TypeByExtension(filepath.Ext(name)), nil
}
// ETager is an optional interface for the os.FileInfo objects

Loading…
Cancel
Save