Bläddra i källkod

:art: Update av export

Daniel 1 år sedan
förälder
incheckning
2f87e4b4c7
1 ändrade filer med 5 tillägg och 10 borttagningar
  1. 5 10
      kernel/model/import.go

+ 5 - 10
kernel/model/import.go

@@ -260,18 +260,13 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
 				ial := parse.IAL2Map(n.KramdownIAL)
 				ial := parse.IAL2Map(n.KramdownIAL)
 				for k, v := range ial {
 				for k, v := range ial {
 					if strings.HasPrefix(k, NodeAttrNamePrefixAvKey) || strings.HasPrefix(k, NodeAttrNameAvs) {
 					if strings.HasPrefix(k, NodeAttrNamePrefixAvKey) || strings.HasPrefix(k, NodeAttrNameAvs) {
+						newKey, newVal := k, v
 						for oldAvID, newAvID := range avIDs {
 						for oldAvID, newAvID := range avIDs {
-							newKey := strings.ReplaceAll(k, oldAvID, newAvID)
-							newVal := strings.ReplaceAll(v, oldAvID, newAvID)
-							if newKey != k {
-								n.SetIALAttr(newKey, v)
-								n.RemoveIALAttr(k)
-								k = newKey
-							}
-							if newVal != v {
-								n.SetIALAttr(k, newVal)
-							}
+							newKey = strings.ReplaceAll(newKey, oldAvID, newAvID)
+							newVal = strings.ReplaceAll(newVal, oldAvID, newAvID)
 						}
 						}
+						n.RemoveIALAttr(k)
+						n.SetIALAttr(newKey, newVal)
 					}
 					}
 				}
 				}