mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Fix: policy should be re-dispatch while getting thumbnails
This commit is contained in:
@@ -75,7 +75,6 @@ func GetSiteURL() *url.URL {
|
||||
}
|
||||
|
||||
// GetIntSetting 获取整形设置值,如果转换失败则返回默认值defaultVal
|
||||
// TODO 测试
|
||||
func GetIntSetting(key string, defaultVal int) int {
|
||||
res, err := strconv.Atoi(GetSettingByName(key))
|
||||
if err != nil {
|
||||
|
||||
@@ -166,3 +166,21 @@ func TestGetSiteURL(t *testing.T) {
|
||||
asserts.Equal("https://cloudreve.org", siteURL.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetIntSetting(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
|
||||
// 正常
|
||||
{
|
||||
cache.Set("setting_TestGetIntSetting", "10", 0)
|
||||
res := GetIntSetting("TestGetIntSetting", 20)
|
||||
asserts.Equal(10, res)
|
||||
}
|
||||
|
||||
// 使用默认值
|
||||
{
|
||||
res := GetIntSetting("TestGetIntSetting_2", 20)
|
||||
asserts.Equal(20, res)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user