Closed Taeir closed 1 year ago
I'm not familiar with how the cache works. Is there the possibility of storing the tag names in quotes to avoid incomplete matches? Alternatively, could we match on whole words (which might still fail if we or any other instance ever decide to permit spaces in tags). If the tags are always stored one per line, could we match only on whole lines?
The storage is yaml format, automatically managed by rails. I may be able to switch the replacement function to a regex replace and use word boundaries, but not sure if mysql supports those.
If one tag is a prefix to another existing tag, and both tags are present on a post, then deleting the tag will mangle the tags_cache.
For example:
Post A has Tags "hi" and "hi-there", this is saved as
Now take the following actions:
\n- {tag-name}
(\n- hi
) with `` (nothing).This won't actually be a problem until the post is edited, at which point it will put in the tags box the tag "there" (because this YAML isn't invalid). That is the best-case scenario, since this replacement didn't produce malformed YAML. If we had "hit" instead of "hi-there", it would possibly produce invalid yaml which cannot be decoded and crash with error 500.
I don't think any issues occur until you actually go and edit the post, since I expect the list to use the actual tags association rather than the tags_cache.