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

Closed
opened 2 weeks ago by みてるぞ · 2 comments

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

  • *
  • ?

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

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

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

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

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

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

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

まづ,以下の 2 文字を禁則文字と制定する: - `*` - `?` この 2 文字は検索のためのワイルドカードとして用ゐられるため,タグ名としての使用を禁止する(外部タグ含む). また,以下のパターンも禁ずる: - `/` - 2 文字以上連続する `_` - 先頭および末尾の `_` すでに使用されてゐるタグには以下のサニタイズを行ふ: 1. 既存の `*` を `_` に置換 2. 既存の `?` を `_` に置換 3. 連続する `_` を 1 文字の `_` に置換 4. 先頭および末尾の `_` を削除(外部タグの場合はプレフィクスを外して考へる) 5. この結果,空文字列となった場合は名称を `null` に設定 複数のタグと競合する場合は統合を行ふ. **また,ニコニコ連携の処理においても上記の変換を行ふものとする.**
みてるぞ added the
area/backend
label 2 weeks ago
みてるぞ added the
type/enhancement
label 2 weeks ago
みてるぞ added the
P1
label 2 weeks ago
みてるぞ added the
status/ready
label 2 weeks ago
みてるぞ removed the
status/ready
label 2 weeks ago
みてるぞ added the
status/blocked
label 2 weeks ago
みてるぞ changed title from 禁則文字の制定とマイグレーション to 禁則文字の制定とクレンジング 2 weeks ago
みてるぞ removed the
status/blocked
label 2 weeks ago
みてるぞ added the
status/ready
label 2 weeks ago
みてるぞ added the
P0
label 2 weeks ago
みてるぞ removed the
P1
label 2 weeks ago
みてるぞ added a new dependency 2 weeks ago
みてるぞ changed title from 禁則文字の制定とクレンジング to 禁則文字の制定とサニタイズ 2 weeks ago
みてるぞ commented 2 weeks ago
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
みてるぞ removed the
status/ready
label 2 weeks ago
みてるぞ added the
status/in-progress
label 2 weeks ago
みてるぞ started working 2 weeks ago
みてるぞ stopped working 2 weeks ago
2h 20min 34s
みてるぞ started working 2 weeks ago
みてるぞ stopped working 2 weeks ago
16min 24s
みてるぞ started working 2 weeks ago
みてるぞ stopped working 2 weeks ago
1h 36min 1s
みてるぞ started working 2 weeks ago
みてるぞ stopped working 2 weeks ago
42min 15s
みてるぞ referenced this issue from a commit 2 weeks ago
みてるぞ removed the
status/in-progress
label 2 weeks ago
みてるぞ added the
status/blocked
label 2 weeks ago
みてるぞ added a new dependency 2 weeks ago
みてるぞ added the
status/in-progress
label 2 weeks ago
みてるぞ removed the
status/blocked
label 2 weeks ago
みてるぞ commented 2 weeks ago
Owner

tag_nameswiki_pages も Discardable にしたい.

`tag_names` と `wiki_pages` も Discardable にしたい.
みてるぞ referenced this issue from a commit 2 weeks ago
みてるぞ started working 1 week ago
みてるぞ cancelled time tracking 1 week ago
みてるぞ referenced this issue from a commit 1 week ago
みてるぞ removed the
P0
label 1 week ago
みてるぞ removed the
status/in-progress
label 1 week ago
みてるぞ closed this issue 1 week ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Total Time Spent: 4h 55min 14s
みてるぞ
4h 55min 14s
Due Date

No due date set.

Blocks
#279 検索のワイルドカード
miteruzo/btrc-hub
Depends on
#287 tags を論理削除にする
miteruzo/btrc-hub
#282 タグ統合サービスの作成
miteruzo/btrc-hub
Loading…
There is no content yet.