Skip to content

Commit

Permalink
模型数据集标题大小写敏感问题修复(bug fix) (OpenCSGs#36)
Browse files Browse the repository at this point in the history
* Add database.yml to .gitignore

* fix the bug when create model and dataset

* Update when create same model or dataset

* Update message when create

* Update .gitignore

* Update the zh.yml

* Add case insensitive check for model and dataset name

* Update the NewDataset.vue and NewModel.vue

* Update the placeholder

---------

Co-authored-by: zxr <[email protected]>
Co-authored-by: Hiveer <[email protected]>
  • Loading branch information
3 people authored Jan 22, 2024
1 parent afcddae commit 2d4066b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/javascript/components/datasets/NewDataset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</div>
<div class="flex-1">
<p class="text-[#303133] text-sm mb-2">数据集名称</p>
<el-input v-model="datasetName" placeholder="2-70个小写字母数字_.-的字符串,_.-不能并列出现" input-style="width: 100%" />
<el-input v-model="datasetName" placeholder="2-70个字母数字_.-的字符串,_.-不能并列出现" input-style="width: 100%" />
</div>
</div>
<div class="mb-9">
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/models/NewModel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</div>
<div class="flex-1">
<p class="text-[#303133] text-sm mb-2">模型名称</p>
<el-input v-model="modelName" placeholder="2-70个小写字母数字_.-的字符串,_.-不能并列出现" input-style="width: 100%" />
<el-input v-model="modelName" placeholder="2-70个字母数字_.-的字符串,_.-不能并列出现" input-style="width: 100%" />
</div>
</div>
<div class="mb-9">
Expand Down
2 changes: 1 addition & 1 deletion app/models/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Dataset < ApplicationRecord

validates :name, format: { with: /\A(?=.{2,70}$)(?!.*[_]{2})(?!.*[-]{2})(?!.*[.]{2})[a-zA-Z0-9_.-]+\Z/ }

validates :name, uniqueness: { scope: [:owner_type, :owner_id] }
validates :name, uniqueness: { scope: [:owner_type, :owner_id], case_sensitive: false }

def path
"#{owner.name}/#{name}"
Expand Down
2 changes: 1 addition & 1 deletion app/models/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Model < ApplicationRecord

validates :name, format: { with: /\A(?=.{2,70}$)(?!.*[_]{2})(?!.*[-]{2})(?!.*[.]{2})[a-zA-Z0-9_.-]+\Z/ }

validates :name, uniqueness: { scope: [:owner_type, :owner_id] }
validates :name, uniqueness: { scope: [:owner_type, :owner_id], case_sensitive: false }

def path
"#{owner.name}/#{name}"
Expand Down

0 comments on commit 2d4066b

Please sign in to comment.