禁則文字の制定とサニタイズ #281

Closed
opened 2026-03-06 12:50:06 +09:00 by みてるぞ · 2 comments
Owner

まづ,以下の 2 文字を禁則文字と制定する:

  • *
  • ?

この 2 文字は検索のためのワイルドカードとして用ゐられるため,タグ名としての使用を禁止する(外部タグ含む).

また,以下のパターンも禁ずる:

  • /
  • 2 文字以上連続する _
  • 先頭および末尾の _

すでに使用されてゐるタグには以下のサニタイズを行ふ:

  1. 既存の *_ に置換
  2. 既存の ?_ に置換
  3. 連続する _ を 1 文字の _ に置換
  4. 先頭および末尾の _ を削除(外部タグの場合はプレフィクスを外して考へる)
  5. この結果,空文字列となった場合は名称を null に設定

複数のタグと競合する場合は統合を行ふ.

また,ニコニコ連携の処理においても上記の変換を行ふものとする.

まづ,以下の 2 文字を禁則文字と制定する: - `*` - `?` この 2 文字は検索のためのワイルドカードとして用ゐられるため,タグ名としての使用を禁止する(外部タグ含む). また,以下のパターンも禁ずる: - `/` - 2 文字以上連続する `_` - 先頭および末尾の `_` すでに使用されてゐるタグには以下のサニタイズを行ふ: 1. 既存の `*` を `_` に置換 2. 既存の `?` を `_` に置換 3. 連続する `_` を 1 文字の `_` に置換 4. 先頭および末尾の `_` を削除(外部タグの場合はプレフィクスを外して考へる) 5. この結果,空文字列となった場合は名称を `null` に設定 複数のタグと競合する場合は統合を行ふ. **また,ニコニコ連携の処理においても上記の変換を行ふものとする.**
みてるぞ added the area/backendtype/enhancementP1status/ready labels 2026-03-06 12:50:06 +09:00
みてるぞ added status/blocked and removed status/ready labels 2026-03-07 07:40:46 +09:00
みてるぞ changed title from 禁則文字の制定とマイグレーション to 禁則文字の制定とクレンジング 2026-03-07 07:41:29 +09:00
みてるぞ added a new dependency 2026-03-08 15:24:59 +09:00
みてるぞ added status/ready and removed status/blocked labels 2026-03-08 16:26:14 +09:00
みてるぞ added P0 and removed P1 labels 2026-03-08 23:27:07 +09:00
みてるぞ added a new dependency 2026-03-08 23:27:32 +09:00
みてるぞ changed title from 禁則文字の制定とクレンジング to 禁則文字の制定とサニタイズ 2026-03-08 23:57:58 +09:00
Author
Owner
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
みてるぞ added status/in-progress and removed status/ready labels 2026-03-09 12:31:37 +09:00
みてるぞ started working 2026-03-09 12:31:39 +09:00
みてるぞ worked for 2h 20min 34s 2026-03-09 14:52:13 +09:00
みてるぞ started working 2026-03-09 16:19:03 +09:00
みてるぞ worked for 16min 24s 2026-03-09 16:35:27 +09:00
みてるぞ started working 2026-03-09 17:33:12 +09:00
みてるぞ worked for 1h 36min 1s 2026-03-09 19:09:13 +09:00
みてるぞ started working 2026-03-09 19:42:20 +09:00
みてるぞ worked for 42min 15s 2026-03-09 20:24:35 +09:00
みてるぞ referenced this issue from a commit 2026-03-10 22:35:11 +09:00
みてるぞ added status/blocked and removed status/in-progress labels 2026-03-10 22:35:21 +09:00
みてるぞ added a new dependency 2026-03-10 22:53:50 +09:00
みてるぞ added status/in-progress and removed status/blocked labels 2026-03-11 22:56:46 +09:00
Author
Owner

tag_nameswiki_pages も Discardable にしたい.

`tag_names` と `wiki_pages` も Discardable にしたい.
みてるぞ referenced this issue from a commit 2026-03-12 00:46:22 +09:00
みてるぞ started working 2026-03-12 19:07:01 +09:00
みてるぞ canceled time tracking 2026-03-12 19:07:13 +09:00
みてるぞ referenced this issue from a commit 2026-03-12 21:41:29 +09:00
みてるぞ removed the P0status/in-progress labels 2026-03-12 22:07:58 +09:00
Sign in to join this conversation.
1 Participants
Notifications
Total Time Spent: 4 hours 55 minutes
みてるぞ
4 hours 55 minutes
Due Date
No due date set.
Reference: miteruzo/btrc-hub#281