mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: get OneDrive thumbnails
This commit is contained in:
@@ -3,7 +3,7 @@ package controllers
|
||||
import "C"
|
||||
import (
|
||||
"context"
|
||||
"github.com/HFO4/cloudreve/models"
|
||||
model "github.com/HFO4/cloudreve/models"
|
||||
"github.com/HFO4/cloudreve/pkg/filesystem"
|
||||
"github.com/HFO4/cloudreve/pkg/filesystem/driver/local"
|
||||
"github.com/HFO4/cloudreve/pkg/filesystem/fsctx"
|
||||
@@ -244,12 +244,6 @@ func FileUploadStream(c *gin.Context) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
// 非本地策略时拒绝上传
|
||||
if user, ok := c.Get("user"); ok && user.(*model.User).Policy.Type != "local" {
|
||||
c.JSON(200, serializer.Err(serializer.CodePolicyNotAllowed, "当前存储策略无法使用", nil))
|
||||
return
|
||||
}
|
||||
|
||||
// 取得文件大小
|
||||
fileSize, err := strconv.ParseUint(c.Request.Header.Get("Content-Length"), 10, 64)
|
||||
if err != nil {
|
||||
@@ -257,6 +251,12 @@ func FileUploadStream(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 非可用策略时拒绝上传
|
||||
if user, ok := c.Get("user"); ok && !user.(*model.User).Policy.IsTransitUpload(fileSize) {
|
||||
c.JSON(200, serializer.Err(serializer.CodePolicyNotAllowed, "当前存储策略无法使用", nil))
|
||||
return
|
||||
}
|
||||
|
||||
// 解码文件名和路径
|
||||
fileName, err := url.QueryUnescape(c.Request.Header.Get("X-FileName"))
|
||||
filePath, err := url.QueryUnescape(c.Request.Header.Get("X-Path"))
|
||||
|
||||
Reference in New Issue
Block a user