Skip to content

Çok satırlı (multiline) mesajlar WebSocket JSON parse hatasına ve process çökmesine sebep oluyor #4

Description

@emrullahctrl

Bir kullanıcı, birden fazla satırdan oluşan bir mesaj gönderdiğinde (mesaj içinde literal \n newline karakteri geçtiğinde), kütüphane gelen WebSocket verisini JSON.parse() ile işlerken hata fırlatıyor ve bu hata yakalanmadığı (try/catch içine alınmadığı) için tüm bot process'i çöküyor.

Hata çıktısı:

SyntaxError: Bad control character in string literal in JSON at position 47 (line 1 column 48)
    at JSON.parse (<anonymous>)
    at WebSocket.<anonymous> (node_modules/topluyo-bot/index.js:329:28)
    at WebSocket.emit (node:events:519:28)
    at Receiver.receiverOnMessage (node_modules/ws/lib/websocket.js:1239:20)
    ...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions