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

Epic Free Games 路由异常 #13548

Closed
1 task done
People-11 opened this issue Oct 18, 2023 · 3 comments · Fixed by #13662
Closed
1 task done

Epic Free Games 路由异常 #13548

People-11 opened this issue Oct 18, 2023 · 3 comments · Fixed by #13662

Comments

@People-11
Copy link
Contributor

People-11 commented Oct 18, 2023

路由地址

/epicgames/freegames/:locale?/:country?

完整路由地址

/epicgames/freegames/zh_CN

相关文档

https://docs.rsshub.app/routes/game#epic-games-store

预期是什么?

在 index.js 的第 44 行

const linkSlug = item.catalogNs.mappings.length > 0 ? item.catalogNs.mappings[0].pageSlug : item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug : item.productSlug ? item.productSlug : item.urlSlug;

如果 item.catalogNs.mappings 数组的长度大于 0,就取 item.catalogNs.mappings[0].pageSlug 的值作为 linkSlug。

如果上述条件不满足,且 item.offerMappings 数组的长度大于 0,就取 item.offerMappings[0].pageSlug 的值作为 linkSlug。

如果前两个条件都不满足,且 item.productSlug 存在(不为 falsy 值,比如 null、undefined、false 等),就取 item.productSlug 的值作为 linkSlug。

如果前三个条件都不满足,就取 item.urlSlug 的值作为 linkSlug。

实际发生了什么?

在 index.js 的第 44 行

const linkSlug = item.catalogNs.mappings.length > 0 ? item.catalogNs.mappings[0].pageSlug : item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug : item.productSlug ? item.productSlug : item.urlSlug;

判断 item.catalogNs.mappings 和 item.offerMappings 的长度大于 0 (即有内容存在) 时,使用 item.catalogNs.mappings 或 item.offerMappings

但是,当这两个值为 null 或 undefined 时,实际上无法读取长度,则会报 Cannot read properties of null (reading 'length') 错误

实际上,这种情况已经发生 (如下图)

Snipaste_2023-10-19_06-42-47 Snipaste_2023-10-19_06-58-23

部署

RSSHub 演示 (https://rsshub.app)

部署相关信息

Vercel

额外信息

Cannot read properties of null (reading 'length')

这不是重复的 issue

  • 我已经搜索了 现有 issue,以确保该错误尚未被报告。
@github-actions
Copy link
Contributor

Searching for maintainers:
  • /epicgames/freegames/: Route not found

To maintainers: if you are not willing to be disturbed, list your username in scripts/workflow/test-issue/call-maintainer.js. In this way, your username will be wrapped in an inline code block when tagged so you will not be notified.

如果所有路由都无法匹配,issue 将会被自动关闭。如果 issue 和路由无关,请使用 NOROUTE 关键词,或者留下评论。我们会重新审核。
If all routes can not be found, the issue will be closed automatically. Please use NOROUTE for a route-irrelevant issue or leave a comment if it is a mistake.

@github-actions
Copy link
Contributor

Searching for maintainers:

To maintainers: if you are not willing to be disturbed, list your username in scripts/workflow/test-issue/call-maintainer.js. In this way, your username will be wrapped in an inline code block when tagged so you will not be notified.

如果所有路由都无法匹配,issue 将会被自动关闭。如果 issue 和路由无关,请使用 NOROUTE 关键词,或者留下评论。我们会重新审核。
If all routes can not be found, the issue will be closed automatically. Please use NOROUTE for a route-irrelevant issue or leave a comment if it is a mistake.

1 similar comment
@github-actions
Copy link
Contributor

Searching for maintainers:

To maintainers: if you are not willing to be disturbed, list your username in scripts/workflow/test-issue/call-maintainer.js. In this way, your username will be wrapped in an inline code block when tagged so you will not be notified.

如果所有路由都无法匹配,issue 将会被自动关闭。如果 issue 和路由无关,请使用 NOROUTE 关键词,或者留下评论。我们会重新审核。
If all routes can not be found, the issue will be closed automatically. Please use NOROUTE for a route-irrelevant issue or leave a comment if it is a mistake.

TonyRL pushed a commit that referenced this issue Oct 31, 2023
…g 'length') (#13662)

* Fix #13548

Cannot read properties of null (reading 'length')

* Fix Doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant