Skip to content

Commit

Permalink
fix: 修复无法自定义文件后缀的冒号和@符号的问题 #280
Browse files Browse the repository at this point in the history
  • Loading branch information
OBKoro1 committed Feb 22, 2021
1 parent cc4e215 commit ed00122
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Author : OBKoro1
* Date : 2020-02-17 13:24:54
* @LastEditors : OBKoro1
* @LastEditTime : 2021-02-22 15:13:06
* @LastEditTime : 2021-02-22 15:54:59
* File : \koro1FileHeader\CHANGELOG.md
* Description :
* https://github.com/OBKoro1
Expand All @@ -15,6 +15,7 @@
### [V4.8.3]

* feat: 新增`@`符号在[自定义信息](https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE#7-%E5%9C%A8%E6%B3%A8%E9%87%8A%E4%B8%AD%E8%BE%93%E5%87%BA%E4%B8%80%E6%AE%B5%E8%87%AA%E5%AE%9A%E4%B9%89%E4%BF%A1%E6%81%AF)中自动删除(`custom_string_obkoro1`~`custom_string_obkoro100`)
* fix: 修复无法自定义文件后缀的冒号和`@`符号的问题, [#280](https://github.com/OBKoro1/koro1FileHeader/issues/280)

### [V4.8.2]

Expand Down
14 changes: 9 additions & 5 deletions src/languageOutPut/languageDifferent.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,20 @@ TplJudge.prototype = {
}
const [constName, objName] = obj[symbolName]
let arr = this.config.configObj[objName][this.fsPath] // 文件后缀是否设置
if (arr !== undefined && !Array.isArray(arr)) {
// 有值 不是数组 设置为数组
arr = [arr, arr]
} else {
arr = this.config.configObj[constName] // 所有文件后缀的默认值
if (arr === undefined) {
// 没值 采用所有文件后缀的默认值
arr = this.config.configObj[constName]
if (!Array.isArray(arr)) {
// 不是数组 设置为数组
arr = [arr, arr]
}
} else {
// 有值 不是数组 设置为数组
if (!Array.isArray(arr)) {
arr = [arr, arr]
}
}

this[constName] = arr
},

Expand Down

0 comments on commit ed00122

Please sign in to comment.