Skip to content

Commit 9348cd3

Browse files
author
pzrr@qq.com
committed
#### Version 1.4.3
* 调整dotweb内部路由注册逻辑,New模式默认不开启,Classic模式默认开启,可通过app.UseDotwebRouter手动开启 * 修复 issue devfeel#100, 解决特定场景下Exclude不生效问题 * Use filepath.Ext to replace file.GetFileExt, update for issue devfeel#99 * 移除 framework/file.GetFileExt 函数 * 同步更新example代码 * 2018-01-07 22:00
1 parent 7828e6c commit 9348cd3

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

framework/file/file.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@ func GetCurrentDirectory() string {
1616
return strings.Replace(dir, "\\", "/", -1)
1717
}
1818

19-
//get filename extensions
20-
func GetFileExt(fileName string) string {
21-
if fileName == "" {
22-
return ""
23-
} else {
24-
index := strings.LastIndex(fileName, ".")
25-
if index < 0 {
26-
return ""
27-
} else {
28-
return string(fileName[index:])
29-
}
30-
}
31-
}
32-
3319
//check filename is exist
3420
func Exist(filename string) bool {
3521
_, err := os.Stat(filename)

framework/file/file_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package file
22

33
import (
4+
"path/filepath"
45
"testing"
56
)
67

@@ -13,7 +14,7 @@ func Test_GetCurrentDirectory_1(t *testing.T) {
1314

1415
func Test_GetFileExt_1(t *testing.T) {
1516
fn := "/download/vagrant_1.9.2.dmg"
16-
fileExt := GetFileExt(fn)
17+
fileExt := filepath.Ext(fn)
1718
if len(fileExt) < 1 {
1819
t.Error("fileExt null!")
1920
} else {
@@ -23,7 +24,7 @@ func Test_GetFileExt_1(t *testing.T) {
2324

2425
func Test_GetFileExt_2(t *testing.T) {
2526
fn := "/download/vagrant_1"
26-
fileExt := GetFileExt(fn)
27+
fileExt := filepath.Ext(fn)
2728
if len(fileExt) < 1 {
2829
t.Error("fileExt null!")
2930
} else {

version.MD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* 调整dotweb内部路由注册逻辑,New模式默认不开启,Classic模式默认开启,可通过app.UseDotwebRouter手动开启
55
* 修复 issue #100, 解决特定场景下Exclude不生效问题
66
* Use filepath.Ext to replace file.GetFileExt, update for issue #99
7+
* 移除 framework/file.GetFileExt 函数
78
* 同步更新example代码
89
* 2018-01-07 22:00
910

0 commit comments

Comments
 (0)