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

if a noteViewInterruptor plugin throws, all note displays break #14050

Closed
1 task
dakkar opened this issue Jun 20, 2024 · 0 comments · Fixed by #14226
Closed
1 task

if a noteViewInterruptor plugin throws, all note displays break #14050

dakkar opened this issue Jun 20, 2024 · 0 comments · Fixed by #14226
Labels
⚠️bug? This might be a bug

Comments

@dakkar
Copy link
Contributor

dakkar commented Jun 20, 2024

💡 Summary

The install function packages/frontend/src/plugin.ts passes an err function to the Interpreter constructor, for the purpose of logging errors.

The Interpreter.handleError function, when an err is present, calls this.abort(). That makes all future calls to _eval (and therefore _run, and therefore exec) to return null. All future calls, because nothing ever resets the .stop attribute of the interpreter.

The MkNote*.vue components call all noteViewInterruptors one after the other, expecting them to return a Misskey.entities.Note | null, and when they return null, the note gets marked as deleted.

So, when a noteViewInterruptor's code throws an exception, all notes rendered after that will be considered deleted, and not shown.

🥰 Expected Behavior

  • the error gets logged
  • other plugins still run on the note that triggered the error
  • other notes are not affected

🤬 Actual Behavior

  • the error gets logged
  • all notes afterwards are not shown

📝 Steps to Reproduce

Install a plugin like:

/// @ 0.18.0
### {
  name: "test"
  version: "1.0.0-aiscript0.18.0"
  author: "@dakkar"
  description: "breaks"
  permissions: null
  config: null
}

Plugin:register_note_view_interruptor(@(note) {
  note.text.split(' ')
  return note
})

create a note with no text (e.g. just an image attached)

switch between "home" and "global" timeline

your timeline is now empty

💻 Frontend Environment

* Model and OS of the device(s): Linux
* Browser: Firefox 126
* Server URL: local test/dev instance
* Misskey: 2024.5.0

🛰 Backend Environment (for server admin)

* Installation Method or Hosting Service: local test/dev instance
* Misskey: 2024.5.0
* Node: 20.11.0
* PostgreSQL: 16.3
* Redis: 7.2.4
* OS and Architecture: linux amd64

Do you want to address this bug yourself?

  • Yes, I will patch the bug myself and send a pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️bug? This might be a bug
Projects
None yet
1 participant