[change] upload process return value

This commit is contained in:
Max 2022-11-16 18:35:37 +08:00
parent e157945bd1
commit 98631d4002
2 changed files with 14 additions and 0 deletions

View file

@ -2,6 +2,7 @@ package form
import ( import (
"fmt" "fmt"
"net/url"
"strings" "strings"
"github.com/yaoapp/gou" "github.com/yaoapp/gou"
@ -135,6 +136,12 @@ func processUpload(process *gou.Process) interface{} {
exception.New(err.Error(), 500).Throw() exception.New(err.Error(), 500).Throw()
} }
if file, ok := res.(string); ok {
field := strings.TrimSuffix(xpath, ".edit.props")
file = fmt.Sprintf("/api/__yao/form/%s/download/%s?name=%s", form.ID, url.QueryEscape(field), file)
return file
}
return res return res
} }

View file

@ -4,6 +4,7 @@ import (
"crypto/md5" "crypto/md5"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"net/url"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -122,6 +123,12 @@ func processUpload(process *gou.Process) interface{} {
exception.New(err.Error(), 500).Throw() exception.New(err.Error(), 500).Throw()
} }
if file, ok := res.(string); ok {
field := strings.TrimSuffix(xpath, ".edit.props")
file = fmt.Sprintf("/api/__yao/table/%s/download/%s?name=%s", tab.ID, url.QueryEscape(field), file)
return file
}
return res return res
} }