[go: up one dir, main page]

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

Add ability to configure allowed file types #593

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pbf
Copy link
@pbf pbf commented Jul 22, 2023

This PR adds ability to configure allowed file types via config.yaml file. I went for using MIME types identifiers rather than extensions because it maps better to existing file type handling in szurubooru. The files that are of unallowed types are rejected with szuruburu.func.posts.InvalidPostContentError, same as with unsupported files but with different error message.

@sticknuder
Copy link

When I tried to merge this into my custom Szurubooru fork, I couldn't figure out how to allow my own custom filetype.

I'm wondering if this PR could help me allow arbitrary binary files with a specific set of possible extensions. (.nodes, .stknds, and .nodemc)

I understand that they wouldn't be preview-able, but I would like to allow them nonetheless.

@pbf
Copy link
Author
pbf commented Jan 11, 2024

@sticknuder Sorry for late answer, but I hadn't visited this PR in a while.

No, I'm afraid this PR won't help you with implementing this kind of functionality. It adds option to restrict file types that are allowed on a given szurubooru instance, but it doesn't extend the file format support in szurubooru itself. Adding such support may be tricky, since szurubooru seem to throw an error in func.posts.update_post_content if new post isn't an image, video or flash animation. I suppose one would need to code the handling of such generic types as you describe.

@sticknuder
Copy link

@pbf thanks for the response, but don't worry in the end I was able to do it 😁👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants