Skip to content

Commit

Permalink
v1.2.4: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mizuki1412 committed Mar 1, 2022
1 parent 4173a19 commit c108499
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BINARY=go-core-kit
VERSION=1.2.4
VERSION=1.2.5
DATE=`date +%FT%T%z`
.PHONY: init build

Expand Down
16 changes: 8 additions & 8 deletions mod/common/download/download_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ func downloadPublic(ctx *context.Context) {
if subDir == "" || (subDir != "." && (len(subs) == 1 || strings.Index(subDir, subs[0]) < 0)) {
panic(exception.New("未授权开放目录"))
}
dotIndex := strings.LastIndex(params.Name, ".")
var filename string
if dotIndex >= 0 {
filename = cryptokit.URLEncode(params.Name[0:dotIndex]) + params.Name[dotIndex:]
} else {
filename = cryptokit.URLEncode(params.Name)
}
ctx.File(params.Name, filename)
//dotIndex := strings.LastIndex(params.Name, ".")
//var filename string
//if dotIndex >= 0 {
// filename = cryptokit.URLEncode(params.Name[0:dotIndex]) + params.Name[dotIndex:]
//} else {
// filename = cryptokit.URLEncode(params.Name)
//}
ctx.File2(params.Name)
}
3 changes: 3 additions & 0 deletions service/restkit/context/response_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ func (ctx *Context) FileRaw(data []byte, name string) {
func (ctx *Context) File(relativePath, name string) {
ctx.FileDirect(storagekit.GetFullPath(relativePath), name)
}
func (ctx *Context) File2(relativePathName string) {
ctx.Proxy.File(storagekit.GetFullPath(relativePathName))
}

func (ctx *Context) FileDirect(obsolutePath, name string) {
ctx.Proxy.File(obsolutePath + name)
Expand Down
6 changes: 0 additions & 6 deletions service/restkit/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ func EmbedHtmlHandle(fs embed.FS, root string) func(c *context.Context) {
_, _ = c.Proxy.Writer.Write([]byte(err.Error()))
return
}
//f, err := pkger.Open(pkPath + pathName)
//if err != nil {
// _, _ = c.Write([]byte(err.Error()))
// return
//}
data := make([]byte, 0, 1024*5)
for true {
temp := make([]byte, 1024)
Expand All @@ -155,7 +150,6 @@ func EmbedHtmlHandle(fs embed.FS, root string) func(c *context.Context) {
data = append(data, temp[:n]...)
}
}
//_ = mime.AddExtensionType(".js", "text/javascript")
// mine
i := strings.LastIndex(pathName, ".")
if i > 0 {
Expand Down

0 comments on commit c108499

Please sign in to comment.