class << self
def apply!
TagName.find_each do |tn|
name = sanitise(tn.name)
next if name == tn.name
tn.update_columns(name:, updated_at: Time.current)
end
end
private
def sanitise name
order(:priority).reduce(name.dup) do |value, tnsr|
value.gsub(Regexp.new(tnsr.source_pattern), tnsr.replacement)
end
end
end
```
class << self
def apply!
TagName.find_each do |tn|
name = sanitise(tn.name)
next if name == tn.name
tn.update_columns(name:, updated_at: Time.current)
end
end
private
def sanitise name
order(:priority).reduce(name.dup) do |value, tnsr|
value.gsub(Regexp.new(tnsr.source_pattern), tnsr.replacement)
end
end
end
まづ,以下の 2 文字を禁則文字と制定する:
*?この 2 文字は検索のためのワイルドカードとして用ゐられるため,タグ名としての使用を禁止する(外部タグ含む).
また,以下のパターンも禁ずる:
/__すでに使用されてゐるタグには以下のサニタイズを行ふ:
*を_に置換?を_に置換_を 1 文字の_に置換_を削除(外部タグの場合はプレフィクスを外して考へる)nullに設定複数のタグと競合する場合は統合を行ふ.
また,ニコニコ連携の処理においても上記の変換を行ふものとする.
禁則文字の制定とマイグレーションto 禁則文字の制定とクレンジング 2 weeks ago禁則文字の制定とクレンジングto 禁則文字の制定とサニタイズ 2 weeks agotag_namesとwiki_pagesも Discardable にしたい.