mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-08-28 04:46:42 -04:00
Only use index when ranging over slices of structs
This commit is contained in:
@@ -31,9 +31,9 @@ func GetRemoteDataFromServer(clientDeviceID string) {
|
||||
//// server time
|
||||
fetchResp.ServerTime = time.Now().Unix()
|
||||
//// deletions
|
||||
for _, deletion := range deletionsList {
|
||||
for i := range deletionsList {
|
||||
// perform deletion if it is relevant to the current client device
|
||||
affectedIDVanityPath := strings.Split(deletion.Name(), global.FSSpace)
|
||||
affectedIDVanityPath := strings.Split(deletionsList[i].Name(), global.FSSpace)
|
||||
if affectedIDVanityPath[0] == clientDeviceID {
|
||||
var isAgeFile bool
|
||||
if affectedIDVanityPath[1] == "age" {
|
||||
@@ -42,7 +42,7 @@ func GetRemoteDataFromServer(clientDeviceID string) {
|
||||
fetchResp.Deletions = append(fetchResp.Deletions, synccommon.Deletion{VanityPath: strings.ReplaceAll(affectedIDVanityPath[2], global.FSPath, "/"), IsAgeFile: isAgeFile})
|
||||
|
||||
// assume successful client deletion and remove deletions file (if assumption is somehow false, worst case scenario is that the client will re-upload the deleted entry)
|
||||
if err = os.RemoveAll(global.CfgDir + global.PathSeparator + "deletions" + global.PathSeparator + deletion.Name()); err != nil {
|
||||
if err = os.RemoveAll(global.CfgDir + global.PathSeparator + "deletions" + global.PathSeparator + deletionsList[i].Name()); err != nil {
|
||||
fmt.Printf("{\"errMsg\":\"%s\"}", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user