[bug] Corrupt upload breaks API #382

Closed
opened 2024-03-31 00:09:37 +00:00 by xerz · 2 comments

Version

2024.03

What were you trying to do?

shitpost

specifically, by uploading a picture attachment

What did you expect to happen?

shitpost

specifically, by publishing a post with the requested picture attachment

What actually happened?

The attachment did not get successfully uploaded. Further attempts at uploading any attachments failed.

Attempting to load my akkoma-fe homepage now results in a blank screen. Only the following error is reported by the server on load:

Mar 30 19:31:14 fedi pleroma[1796962]: Server: 127.0.0.1:4000 (http)
Mar 30 19:31:14 fedi pleroma[1796962]: Request: GET /media/0160ee57578a53ad4799036819205d1db06a78808fd921d475925862e5fb8341.webp
Mar 30 19:31:14 fedi pleroma[1796962]: ** (exit) an exception was raised:
Mar 30 19:31:14 fedi pleroma[1796962]:     ** (ArgumentError) construction of binary failed: segment 1 of type 'binary': expected a binary but got: nil
Mar 30 19:31:14 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/plugs/uploaded_media.ex:73: Pleroma.Web.Plugs.UploadedMedia.media_is_banned/2
Mar 30 19:31:14 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/plugs/uploaded_media.ex:60: Pleroma.Web.Plugs.UploadedMedia.call/2
Mar 30 19:31:14 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/endpoint.ex:5: Pleroma.Web.Endpoint.plug_builder_call/2
Mar 30 19:31:14 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/endpoint.ex:5: Pleroma.Web.Endpoint.call/2
Mar 30 19:31:14 fedi pleroma[1796962]:         (plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
Mar 30 19:31:14 fedi pleroma[1796962]:         (cowboy 2.10.0) /woodpecker/src/akkoma.dev/AkkomaGang/akkoma/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
Mar 30 19:31:14 fedi pleroma[1796962]:         (cowboy 2.10.0) /woodpecker/src/akkoma.dev/AkkomaGang/akkoma/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
Mar 30 19:31:14 fedi pleroma[1796962]:         (cowboy 2.10.0) /woodpecker/src/akkoma.dev/AkkomaGang/akkoma/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3

Oddly enough, that file exists and can be retrieved via SSH. It's not the attachment media, but the akkoma-fe header icon.

In addition, trying to use a different client to upload new media returns an Internal Server Error, with the server reporting messages like this:

Mar 30 19:27:39 fedi pleroma[1796962]: Request: POST /api/v1/media
Mar 30 19:27:39 fedi pleroma[1796962]: ** (exit) an exception was raised:
Mar 30 19:27:39 fedi pleroma[1796962]:     ** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1
Mar 30 19:27:39 fedi pleroma[1796962]:         (elixir 1.15.4) lib/io.ex:671: IO.chardata_to_string(nil)
Mar 30 19:27:39 fedi pleroma[1796962]:         (elixir 1.15.4) lib/path.ex:547: Path.join/2
Mar 30 19:27:39 fedi pleroma[1796962]:         (elixir 1.15.4) lib/path.ex:517: Path.join/1
Mar 30 19:27:39 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/upload.ex:95: Pleroma.Upload.store/2
Mar 30 19:27:39 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/activity_pub/activity_pub.ex:1506: Pleroma.Web.ActivityPub.ActivityPub.upload/2
Mar 30 19:27:39 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/mastodon_api/controllers/media_controller.ex:25: Pleroma.Web.MastodonAPI.MediaController.create/2
Mar 30 19:27:39 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/mastodon_api/controllers/media_controller.ex:5: Pleroma.Web.MastodonAPI.MediaController.action/2
Mar 30 19:27:39 fedi pleroma[1796962]:         (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/mastodon_api/controllers/media_controller.ex:5: Pleroma.Web.MastodonAPI.MediaController.phoenix_controller_pipeline/2

I'm using local media storage, no S3 buckets or anything alike.

Severity

I cannot use the software

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Version 2024.03 ### What were you trying to do? shitpost specifically, by uploading a picture attachment ### What did you expect to happen? shitpost specifically, by publishing a post with the requested picture attachment ### What actually happened? The attachment did not get successfully uploaded. Further attempts at uploading any attachments failed. Attempting to load my `akkoma-fe` homepage now results in a blank screen. Only the following error is reported by the server on load: ``` Mar 30 19:31:14 fedi pleroma[1796962]: Server: 127.0.0.1:4000 (http) Mar 30 19:31:14 fedi pleroma[1796962]: Request: GET /media/0160ee57578a53ad4799036819205d1db06a78808fd921d475925862e5fb8341.webp Mar 30 19:31:14 fedi pleroma[1796962]: ** (exit) an exception was raised: Mar 30 19:31:14 fedi pleroma[1796962]: ** (ArgumentError) construction of binary failed: segment 1 of type 'binary': expected a binary but got: nil Mar 30 19:31:14 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/plugs/uploaded_media.ex:73: Pleroma.Web.Plugs.UploadedMedia.media_is_banned/2 Mar 30 19:31:14 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/plugs/uploaded_media.ex:60: Pleroma.Web.Plugs.UploadedMedia.call/2 Mar 30 19:31:14 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/endpoint.ex:5: Pleroma.Web.Endpoint.plug_builder_call/2 Mar 30 19:31:14 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/endpoint.ex:5: Pleroma.Web.Endpoint.call/2 Mar 30 19:31:14 fedi pleroma[1796962]: (plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2 Mar 30 19:31:14 fedi pleroma[1796962]: (cowboy 2.10.0) /woodpecker/src/akkoma.dev/AkkomaGang/akkoma/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2 Mar 30 19:31:14 fedi pleroma[1796962]: (cowboy 2.10.0) /woodpecker/src/akkoma.dev/AkkomaGang/akkoma/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3 Mar 30 19:31:14 fedi pleroma[1796962]: (cowboy 2.10.0) /woodpecker/src/akkoma.dev/AkkomaGang/akkoma/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3 ``` Oddly enough, that file exists and can be retrieved via SSH. It's not the attachment media, but the `akkoma-fe` header icon. In addition, trying to use a different client to upload new media returns an Internal Server Error, with the server reporting messages like this: ``` Mar 30 19:27:39 fedi pleroma[1796962]: Request: POST /api/v1/media Mar 30 19:27:39 fedi pleroma[1796962]: ** (exit) an exception was raised: Mar 30 19:27:39 fedi pleroma[1796962]: ** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1 Mar 30 19:27:39 fedi pleroma[1796962]: (elixir 1.15.4) lib/io.ex:671: IO.chardata_to_string(nil) Mar 30 19:27:39 fedi pleroma[1796962]: (elixir 1.15.4) lib/path.ex:547: Path.join/2 Mar 30 19:27:39 fedi pleroma[1796962]: (elixir 1.15.4) lib/path.ex:517: Path.join/1 Mar 30 19:27:39 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/upload.ex:95: Pleroma.Upload.store/2 Mar 30 19:27:39 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/activity_pub/activity_pub.ex:1506: Pleroma.Web.ActivityPub.ActivityPub.upload/2 Mar 30 19:27:39 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/mastodon_api/controllers/media_controller.ex:25: Pleroma.Web.MastodonAPI.MediaController.create/2 Mar 30 19:27:39 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/mastodon_api/controllers/media_controller.ex:5: Pleroma.Web.MastodonAPI.MediaController.action/2 Mar 30 19:27:39 fedi pleroma[1796962]: (pleroma 3.12.0-0-g11c305b) lib/pleroma/web/mastodon_api/controllers/media_controller.ex:5: Pleroma.Web.MastodonAPI.MediaController.phoenix_controller_pipeline/2 ``` I'm using local media storage, no S3 buckets or anything alike. ### Severity I cannot use the software ### Have you searched for this issue? - [x] I have double-checked and have not found this issue mentioned anywhere.
Author

....just noticed I posted this on the wrong repo and it should have gone on AkkomaGang/akkoma instead oops, do I close the ticket?

....just noticed I posted this on the wrong repo and it should have gone on [AkkomaGang/akkoma](https://akkoma.dev/AkkomaGang/akkoma) instead oops, do I close the ticket?
Author

Worth noting: deleting the drafts key from local akkoma-fe storage did bring the UI back. Creating a new draft with a new upload breaks the UI once again. I found this is due to the presence of an object key "files":[{}].

The header icon looks gone despite being stored locally ofc, so I went to admin settings to delete and reupload the instance logo, but reuploading failed with the same no function clause matching in IO.chardata_to_string/1 error as above.

Worth noting: deleting the `drafts` key from local `akkoma-fe` storage did bring the UI back. Creating a new draft with a new upload breaks the UI once again. I found this is due to the presence of an object key `"files":[{}]`. The header icon looks gone despite being stored locally ofc, so I went to admin settings to delete and reupload the instance logo, but reuploading failed with the same `no function clause matching in IO.chardata_to_string/1` error as above.
xerz closed this issue 2024-04-01 23:21:46 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: AkkomaGang/akkoma-fe#382
No description provided.