Skip to content

Commit

Permalink
fix(web): fix bucket name pattern (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeezQ authored Jan 19, 2023
1 parent aa8a3af commit 1f58446
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion web/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"Upload": "Upload",
"Used": "Used",
"UploadTip": "Please select a file or folder to upload",
"BucketNameRule": "Can only contain English or numbers"
"BucketNameRule": "Can only contain English or numbers or -, and cannot end with -"
},
"TriggerPanel": {
"AddTrigger": "Add Trigger",
Expand Down
2 changes: 1 addition & 1 deletion web/public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"Used": "已使用",
"Success": "上传成功",
"EmptyText": "暂无Bucket数据",
"BucketNameRule": "只能包含英文或数字"
"BucketNameRule": "只能包含英文或数字或 -,且不能以 - 结尾"
},
"Search": "搜索",
"Close": "关闭",
Expand Down
2 changes: 1 addition & 1 deletion web/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"Upload": "上传",
"Used": "已使用",
"UploadTip": "请选择文件或者文件夹上传",
"BucketNameRule": "只能包含英文或数字"
"BucketNameRule": "只能包含英文或数字或 -,且不能以 - 结尾"
},
"TriggerPanel": {
"AddTrigger": "新建触发器",
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/FileTypeIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function FileTypeIcon(props: { type: string }) {

case FileType.folder:
return (
<Icon viewBox="0 0 20 16" fontSize={20} className="align-middle">
<Icon viewBox="0 0 20 16" width="14px" className="align-middle">
<path
d="M2 16C1.45 16 0.979333 15.8043 0.588 15.413C0.196 15.021 0 14.55 0 14V2C0 1.45 0.196 0.979333 0.588 0.588C0.979333 0.196 1.45 0 2 0H8L10 2H18C18.55 2 19.021 2.196 19.413 2.588C19.8043 2.97933 20 3.45 20 4V14C20 14.55 19.8043 15.021 19.413 15.413C19.021 15.8043 18.55 16 18 16H2Z"
fill="#47C8BF"
Expand All @@ -124,7 +124,7 @@ export default function FileTypeIcon(props: { type: string }) {
case FileType.jpeg:
case FileType.gif:
return (
<Icon viewBox="0 0 20 18" fontSize={20} className="align-middle">
<Icon viewBox="0 0 20 18" width="14px" style={{ verticalAlign: "-1px" }}>
<path
d="M18 0C18.5304 0 19.0391 0.210714 19.4142 0.585786C19.7893 0.960859 20 1.46957 20 2V16C20 16.5304 19.7893 17.0391 19.4142 17.4142C19.0391 17.7893 18.5304 18 18 18H2C1.46957 18 0.960859 17.7893 0.585786 17.4142C0.210714 17.0391 0 16.5304 0 16V2C0 1.46957 0.210714 0.960859 0.585786 0.585786C0.960859 0.210714 1.46957 0 2 0H18ZM18 2H2V16H2.929L12.237 6.692C12.3531 6.57589 12.4909 6.48379 12.6426 6.42095C12.7942 6.35811 12.9568 6.32577 13.121 6.32577C13.2852 6.32577 13.4478 6.35811 13.5994 6.42095C13.7511 6.48379 13.8889 6.57589 14.005 6.692L18 10.686V2ZM13.121 8.636L5.757 16H18V13.515L13.121 8.636ZM5.5 4C5.89782 4 6.27936 4.15804 6.56066 4.43934C6.84196 4.72064 7 5.10218 7 5.5C7 5.89782 6.84196 6.27936 6.56066 6.56066C6.27936 6.84196 5.89782 7 5.5 7C5.10218 7 4.72064 6.84196 4.43934 6.56066C4.15804 6.27936 4 5.89782 4 5.5C4 5.10218 4.15804 4.72064 4.43934 4.43934C4.72064 4.15804 5.10218 4 5.5 4Z"
fill="#36ADEF"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function CreateBucketModal(props: { storage?: TBucket; children: React.ReactElem
{...register("name", {
required: true,
pattern: {
value: /^[A-Za-z][A-Za-z0-9]+$/,
value: /^[A-Za-z][A-Za-z0-9-]+[A-Za-z]$/,
message: t("StoragePanel.BucketNameRule"),
},
})}
Expand Down

0 comments on commit 1f58446

Please sign in to comment.