diff --git a/store/tag.go b/store/tag.go index 580cd12f83b37416e25bd1764aa0bc82d9bed2c1..1e926301f3bfa8e98b87f99bb01a63ecc0c59315 100644 --- a/store/tag.go +++ b/store/tag.go @@ -125,15 +125,12 @@ func (s *Store) TagInfo(tag string) Tag { return Tag{} } -// TagType sets type of a tag. +// TagType sets type of tag. func (s *Store) TagType(tag, t string) { if !nameRegex.MatchString(tag) || !s.file(s.TagMetadataPath(tag)) { return } - s.getLock("tag_" + tag).Lock() - defer s.getLock("tag_" + tag).Unlock() - if t != ArtistType && t != CharacterType && t != CopyrightType && @@ -144,6 +141,10 @@ func (s *Store) TagType(tag, t string) { return } info := s.TagInfo(tag) + + s.getLock("tag_" + tag).Lock() + defer s.getLock("tag_" + tag).Unlock() + info.Type = t if payload, err := json.Marshal(info); err != nil { s.fatalClose(fmt.Sprintf("Error updating tag %s metadata, %s", tag, err))