Editor improvements#30
Merged
Merged
Conversation
nitn3lav
reviewed
Oct 18, 2024
Comment on lines
+27
to
+51
| impl EditorConfig { | ||
| /// Enable uploads directly in the editor. | ||
| pub fn enable_uploads(mut self, enable: bool) -> Self { | ||
| self.enable_uploads = enable; | ||
| self | ||
| } | ||
|
|
||
| /// Set the max size for uploads. | ||
| pub fn upload_max_size(mut self, max_size: u32) -> Self { | ||
| self.upload_max_size = max_size; | ||
| self | ||
| } | ||
|
|
||
| /// Add an allowed file type to the currently allowed file types. | ||
| pub fn allow_file_type(mut self, file_type: impl Into<Cow<'static, str>>) -> Self { | ||
| self.allowed_file_types.push(file_type.into()); | ||
| self | ||
| } | ||
|
|
||
| /// Reset the allowed file types to the given list. | ||
| pub fn allowed_file_types(mut self, file_types: Vec<Cow<'static, str>>) -> Self { | ||
| self.allowed_file_types = file_types; | ||
| self | ||
| } | ||
| } |
nitn3lav
reviewed
Oct 18, 2024
Comment on lines
+94
to
+100
| fn into_response(self) -> axum::response::Response { | ||
| let status_code = StatusCode::from_u16(match self { | ||
| UploadError::NoFileGiven | UploadError::ImportError => 400, | ||
| UploadError::TypeNotAllowed => 415, | ||
| UploadError::FileTooLarge => 413, | ||
| }) | ||
| .unwrap(); |
Owner
There was a problem hiding this comment.
There are also StatusCode::BAD_REQUEST, StatusCode::UNSUPPORTED_MEDIA_TYPE and StatusCode::PAYLOAD_TOO_LARGE
nitn3lav
reviewed
Oct 18, 2024
nitn3lav
reviewed
Oct 18, 2024
nitn3lav
reviewed
Oct 18, 2024
nitn3lav
reviewed
Oct 18, 2024
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains several things: