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

【BUG】关于description标签和content:encoded标签的识别问题 #32

Closed
z-hanzhe opened this issue Dec 25, 2023 · 10 comments · Fixed by #34
Closed

【BUG】关于description标签和content:encoded标签的识别问题 #32

z-hanzhe opened this issue Dec 25, 2023 · 10 comments · Fixed by #34
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@z-hanzhe
Copy link

我理解的 rss.xml 文件中应该是description标签内为文章描述,content:encoded才是文章的具体内容,但是现在的迁移仅支持识别description,我需要手动将content:encoded修改为description才可以进行全文迁移,而且还报错

我使用的是Typecho RSS,可自行通过链接测试,在线链接不能识别很奇怪,必须将 RSS 下载为 xml 文件才行

image

@LIlGG
Copy link
Member

LIlGG commented Dec 25, 2023

RSS 标准规范 中实际上并没有 content:encoded 字段。
但本插件在适配 RSS 的时候是有做 content:encoded 字段处理的,如下所示:

content: {
raw: post["content:encoded"] || post.description,
content: post["content:encoded"] || post.description,
rawType: "HTML",

因此应该会优先使用 content:encoded 作为内容,其次才会使用 description

@LIlGG
Copy link
Member

LIlGG commented Dec 25, 2023

/kind support

@f2c-ci-robot f2c-ci-robot bot added the kind/support Categorizes issue or PR as a support question. label Dec 25, 2023
@z-hanzhe
Copy link
Author

然而他并没有优先使用,而是直接报错了....

@mygithubzz1
Copy link

确实导入typecho 的RSS订阅所有请求都会400,但是会显示导入成功不知道什么原因

@LIlGG
Copy link
Member

LIlGG commented Jan 7, 2024

确实导入typecho 的RSS订阅所有请求都会400,但是会显示导入成功不知道什么原因

感谢反馈。

可否提供一下 Halo 日志?我需要日志来分析 400 错误的原因。另外如果是重复导入,请求就会变为 400,因为无法重复导入同一个数据,所以也需要查看一下文章列表是否已经存在待导入的内容。

@mygithubzz1
Copy link

确实导入typecho 的RSS订阅所有请求都会400,但是会显示导入成功不知道什么原因

感谢反馈。

可否提供一下 Halo 日志?我需要日志来分析 400 错误的原因。另外如果是重复导入,请求就会变为 400,因为无法重复导入同一个数据,所以也需要查看一下文章列表是否已经存在待导入的内容。

image
halo.log

@mygithubzz1
Copy link

确实导入typecho 的RSS订阅所有请求都会400,但是会显示导入成功不知道什么原因

感谢反馈。
可否提供一下 Halo 日志?我需要日志来分析 400 错误的原因。另外如果是重复导入,请求就会变为 400,因为无法重复导入同一个数据,所以也需要查看一下文章列表是否已经存在待导入的内容。

image halo.log

导入的数据也是typecho中的RSS订阅文件

@LIlGG
Copy link
Member

LIlGG commented Jan 7, 2024

导入的数据也是typecho中的RSS订阅文件

日志中没有能够看到有明显错误的地方。方便发一份脱敏后的 RSS 地址或者文件给我吗?我用它来导入测试一下。
可以发送至我的邮箱 takagi@halo.run

@LIlGG
Copy link
Member

LIlGG commented Jan 8, 2024

确实导入typecho 的RSS订阅所有请求都会400,但是会显示导入成功不知道什么原因

经过测试确实存在这样的问题,原因是 RSS 内容 content:encoded 中具有额外的属性字段,导致解析后的 content 变成了对象,进而出现 400 错误。

/kind bug

@f2c-ci-robot f2c-ci-robot bot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 8, 2024
@LIlGG
Copy link
Member

LIlGG commented Jan 8, 2024

/remove-kind support

@f2c-ci-robot f2c-ci-robot bot removed the kind/support Categorizes issue or PR as a support question. label Jan 8, 2024
@f2c-ci-robot f2c-ci-robot bot closed this as completed in #34 Jan 8, 2024
f2c-ci-robot bot pushed a commit that referenced this issue Jan 8, 2024
#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:

将 rss 解析 xml 时的 `ignoreAttributes` 属性设置为 true。用于避免可能出现的由于额外属性而导致导入失败的问题。

#### How to test it?

使用具有额外属性的 RSS,例如 `<content:encoded xml:lang="zh-CN">` 等进行导入,查看导入是否成功。

#### Which issue(s) this PR fixes:

Fixes #32 

#### Does this PR introduce a user-facing change?
```release-note
解决由于额外属性所导致的导入失败的问题。
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants