Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix #1597 #1598

Merged
merged 1 commit into from Sep 22, 2023
Merged

fix: Fix #1597 #1598

merged 1 commit into from Sep 22, 2023

Conversation

Losses
Copy link
Contributor

@Losses Losses commented Jul 3, 2023

这条 PR 修复了 #1597 问题,其问题的核心是在 Contents.php 当中的这段 Code:

            if (!$this->checkFieldName($name)) {
                continue;
            }

它检查了 field 名称的「有效性」,并且会自动过滤无效的field,无效 field 的标准是:

    public function checkFieldName(string $name): bool
    {
        return preg_match("/^[_a-z][_a-z0-9]*$/i", $name);
    }

但是这一标准并没有在前端进行检验,提交的时候如果不满足条件过滤过程是静默的,这会让用于产生自己的数据没有被正确保存的幻觉。

本 PR 加入了一个实时的 field name 校验,如果输入了非法值,浏览器会立刻提醒用户进行修改。

image

@joyqi joyqi merged commit e143be0 into typecho:master Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants