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

API Posts Issue #30

Closed
Ynd21 opened this issue May 20, 2023 · 1 comment · Fixed by #31
Closed

API Posts Issue #30

Ynd21 opened this issue May 20, 2023 · 1 comment · Fixed by #31
Assignees
Labels
bug Something isn't working

Comments

@Ynd21
Copy link

Ynd21 commented May 20, 2023

Using Postman

Postman_rynVMBdiM8 I receive a 200 Response (below)

API Response:
{ "author": "on2imnwqggminrg", "collectionId": "tqco9f8weal93h6", "collectionName": "posts", "created": "2023-05-20 04:23:05.739Z", "files": [ "z1qxne4clk31jlw" ], "id": "p5othop5v4z4k18", "nsfw": false, "public": false, "tags": null, "title": "", "updated": "2023-05-20 04:23:05.739Z" }

And the file does appear to be uploaded (admin UI) -

\Edit: It has to do with the invalid type - when setting it to "image/png", it loads correctly on the frontend. I'm not seeing a way to set this via the api call?

chrome_D1uBq0iTaU

The actual post is trying to load a video:

chrome_23oHpUIROy

chrome_sYyga3a3cB

chrome_0J74cGu534

@Dan6erbond Dan6erbond self-assigned this May 20, 2023
@Dan6erbond Dan6erbond added the bug Something isn't working label May 20, 2023
@Dan6erbond
Copy link
Owner

Hey! Thanks for the detailed report! Your diagnosis is correct that the frontend doesn't know which MIME type the image has, and then fallbacks to loading a video.

In the future I might change the way it handles unrecognized MIME types to a generic URL so that users can still copy the direct link.

The way MIME types are handled in Share Me generally still needs improvement. I'd like to move away from the frontend sending this information, since it can be easily detected in the backend, which is what #31 does for the /api/posts route that I'll migrate the frontend to, soon.

Unfortunately PocketBase doesn't have read-only fields as far as I'm aware. So I'll have to find a different way to make the type attribute come from the server side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants