Merge pull request #264 from trheyi/main

[change] upload process return value
This commit is contained in:
Max 2022-11-16 18:46:06 +08:00 committed by GitHub
commit db341092b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

@ -2,6 +2,7 @@ package form
import (
"fmt"
"net/url"
"strings"
"github.com/yaoapp/gou"
@ -135,6 +136,12 @@ func processUpload(process *gou.Process) interface{} {
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
}

View file

@ -4,6 +4,7 @@ import (
"crypto/md5"
"encoding/hex"
"fmt"
"net/url"
"os"
"path/filepath"
"strings"
@ -122,6 +123,12 @@ func processUpload(process *gou.Process) interface{} {
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
}