mirror of
				https://github.com/cloudreve/cloudreve.git
				synced 2025-10-31 08:39:10 +08:00 
			
		
		
		
	Fix: skip the wrong root folder in move path handler
This commit is contained in:
		| @ -162,14 +162,14 @@ func (folder *Folder) MoveFolderTo(dirs []string, dstFolder *Folder) error { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// 更新被移动的目录递归的子目录和文件 | 	// 更新被移动的目录递归的子目录和文件 | ||||||
| 	for _, toBeMoved := range subFolders { | 	for parKey, toBeMoved := range subFolders { | ||||||
|  | 		ignorePath := fullDirs[parKey] | ||||||
| 		// TODO 找到更好的修改办法 | 		// TODO 找到更好的修改办法 | ||||||
|  |  | ||||||
| 		for key, subFolder := range toBeMoved { | 		for _, subFolder := range toBeMoved { | ||||||
| 			// 每个分组的第一个目录已经变更指向,直接跳过 | 			// 每个分组的第一个目录已经变更指向,直接跳过 | ||||||
| 			if key > 0 { | 			if subFolder.PositionAbsolute != ignorePath { | ||||||
| 				newPosition := path.Join(dstFolder.PositionAbsolute, strings.Replace(subFolder.Position, folder.Position, "", 1)) | 				newPosition := path.Join(dstFolder.PositionAbsolute, strings.Replace(subFolder.Position, folder.PositionAbsolute, "", 1)) | ||||||
| 				DB.Model(&subFolder).Updates(map[string]interface{}{ | 				DB.Model(&subFolder).Updates(map[string]interface{}{ | ||||||
| 					"position":          newPosition, | 					"position":          newPosition, | ||||||
| 					"position_absolute": path.Join(newPosition, subFolder.Name), | 					"position_absolute": path.Join(newPosition, subFolder.Name), | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 HFO4
					HFO4