alphapapa / alphapapa/ement.el

Error from nil MXC argument to ement--media-request

未关闭
#315 2 条评论 0 个 reaction 已指派 1 人 已被 @alphapapa 认领 在 GitHub 查看
bug priority:B
主要语言
Emacs Lisp
星标
604
派生
54
PR 合并指标
30 天内没有已合并 PR

描述

I encountered this just now:

```
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-match("mxc://\\([^/]+\\)/\\([^z-a]+\\)" nil)
ement--mxc-to-endpoint(nil)
ement--media-request(nil #s(ement-session ...) :then #f(...) :else #f(...) :queue #s(plz-queue ...) :authenticatedp t)
ement-room--image-download(...)
ement-room--format-m.image(...)
```

In a bit more detail:

```
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-match("mxc://\\([^/]+\\)/\\([^z-a]+\\)" nil)
ement--mxc-to-endpoint(nil)
ement--media-request(nil #s(ement-session :user ... :server ... :token "..." :transaction-id 2562682986 :rooms ... :next-batch "s5356622809_757284974_17004110_3197373295_3474708229_261644646_1399661551_11030818304_0_360008" :device-id nil :initial-device-display-name nil :has-synced-p t :account-data ... :events #) :then #f(compiled-function (&rest args2) #) :else #f(compiled-function (plz-error) "Handle PLZ-ERROR for a failed request to download an image." #) :queue #s(plz-queue :limit 5 :active nil :requests nil :canceled-p nil :first-active nil :last-active nil :first-request nil :last-request nil :finally nil) :authenticatedp t)
ement-room--image-download(#s(ement-event :id "$RGFAXsXzE8GNS8rePT0mKwMhA9Fp4zwF2xDwSMeeFQY" :sender ... :content ... :origin-server-ts 1729344217155 :type "m.room.message" :unsigned ... :state-key nil :receipts nil :local nil) #s(ement-session :user ... :server ... :token "..." :transaction-id 2562682986 :rooms ... :next-batch "s5356622809_757284974_17004110_3197373295_3474708229_261644646_1399661551_11030818304_0_360008" :device-id nil :initial-device-display-name nil :has-synced-p t :account-data ... :events #) :then #f(compiled-function (&rest args2) #) :else #f(compiled-function (plz-error) "Handle PLZ-ERROR for a failed request to download an image." #))
ement-room--format-m.image(#s(ement-event :id "$RGFAXsXzE8GNS8rePT0mKwMhA9Fp4zwF2xDwSMeeFQY" :sender ... :content ... :origin-server-ts 1729344217155 :type "m.room.message" :unsigned ... :state-key nil :receipts nil :local nil) #s(ement-session :user ... :server ... :token "..." :transaction-id 2562682986 :rooms ... :next-batch "s5356622809_757284974_17004110_3197373295_3474708229_261644646_1399661551_11030818304_0_360008" :device-id nil :initial-device-display-name nil :has-synced-p t :account-data ... :events #))
```

This was from the `#emacs:matrix.org` room, so you *might* be able to replicate it. I get the error every time I kill the room buffer and then revisit that room. My current session has history for that room back to 2024-09-27 (Friday).

In addition I was seeing `(ement-api-error "404: Event not found.")` which may be the reason behind the initial error.

I tried the following code change, after which I only get the 404 error.

```diff
modified ement-room.el
@@ -5706,8 +5706,9 @@ ement-room--image-download
(declare (indent defun))
(pcase-let* (((cl-struct ement-event content) event)
((map ('url mxc)) content))
- (ement--media-request mxc session :then then :else else
- :queue ement-images-queue :authenticatedp authenticatedp)))
+ (when mxc
+ (ement--media-request mxc session :then then :else else
+ :queue ement-images-queue :authenticatedp authenticatedp))))

(defun ement-room--format-m.image (event session)
"Return \"m.image\" EVENT on SESSION formatted as a string.
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。