[change] upload process return value
This commit is contained in:
parent
e157945bd1
commit
98631d4002
2 changed files with 14 additions and 0 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue