Skip to content

TypeError when setting a non-existent theme #4765

@feightwywx

Description

@feightwywx

Describe the bug

I'm trying to migrate readme cards to my own instance, which are set up long time a ago. I used &theme=light at that time, and stuck into this:

TypeError: Cannot use 'in' operator to search for 'border_color' in undefined
    at getCardColors (file:///var/task/src/common/color.js:92:20)
    at renderError (file:///var/task/src/common/render.js:156:59)
    at Object.default [as handler] (file:///var/task/api/index.js:140:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async r (/opt/rust/nodejs.js:2:15572)
    at async Server.<anonymous> (/opt/rust/nodejs.js:2:11594)
    at async Server.<anonymous> (/opt/rust/nodejs.js:17:9988)

After removing &theme=light, everything went right. I think the reason is, among this long time, light theme was replaced with default, and setting a theme which doesn't exist caused this problem.

Expected behavior

A more friendly notice, or just fall back to default, i think?

Screenshots / Live demo link

demo

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions