Fix: absolute path cannot be saved for new policy
This commit is contained in:
parent
87fde687eb
commit
175c4d781f
1 changed files with 3 additions and 1 deletions
|
@ -244,7 +244,9 @@ func (service *SlaveTestService) Test() serializer.Response {
|
||||||
|
|
||||||
// Add 添加存储策略
|
// Add 添加存储策略
|
||||||
func (service *AddPolicyService) Add() serializer.Response {
|
func (service *AddPolicyService) Add() serializer.Response {
|
||||||
|
if service.Policy.Type != "local" && service.Policy.Type != "remote" {
|
||||||
service.Policy.DirNameRule = strings.TrimPrefix(service.Policy.DirNameRule, "/")
|
service.Policy.DirNameRule = strings.TrimPrefix(service.Policy.DirNameRule, "/")
|
||||||
|
}
|
||||||
|
|
||||||
if service.Policy.ID > 0 {
|
if service.Policy.ID > 0 {
|
||||||
if err := model.DB.Save(&service.Policy).Error; err != nil {
|
if err := model.DB.Save(&service.Policy).Error; err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue