File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
web/api/v1/contexts/proxy Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ use crate::cache::image::manager::Error;
77
88pub static ERROR_IMAGE_LOADER : Once = Once :: new ( ) ;
99
10- pub static mut ERROR_IMAGE_URL_IS_UNREACHABLE : Bytes = Bytes :: new ( ) ;
11- pub static mut ERROR_IMAGE_URL_IS_NOT_AN_IMAGE : Bytes = Bytes :: new ( ) ;
12- pub static mut ERROR_IMAGE_TOO_BIG : Bytes = Bytes :: new ( ) ;
13- pub static mut ERROR_IMAGE_USER_QUOTA_MET : Bytes = Bytes :: new ( ) ;
14- pub static mut ERROR_IMAGE_UNAUTHENTICATED : Bytes = Bytes :: new ( ) ;
10+ static mut ERROR_IMAGE_URL_IS_UNREACHABLE : Bytes = Bytes :: new ( ) ;
11+ static mut ERROR_IMAGE_URL_IS_NOT_AN_IMAGE : Bytes = Bytes :: new ( ) ;
12+ static mut ERROR_IMAGE_TOO_BIG : Bytes = Bytes :: new ( ) ;
13+ static mut ERROR_IMAGE_USER_QUOTA_MET : Bytes = Bytes :: new ( ) ;
14+ static mut ERROR_IMAGE_UNAUTHENTICATED : Bytes = Bytes :: new ( ) ;
1515
1616const ERROR_IMG_FONT_SIZE : u8 = 16 ;
1717const ERROR_IMG_COLOR : & str = "Red" ;
@@ -33,6 +33,7 @@ pub fn load_error_images() {
3333}
3434
3535pub fn map_error_to_image ( error : & Error ) -> Bytes {
36+ load_error_images ( ) ;
3637 unsafe {
3738 match error {
3839 Error :: UrlIsUnreachable => ERROR_IMAGE_URL_IS_UNREACHABLE . clone ( ) ,
Original file line number Diff line number Diff line change 99//! - Avoid storing images on the server.
1010//!
1111//! The proxy service is a simple cache that stores the images in memory.
12- //!
12+ //!
1313//! **NOTICE:** For now, it only supports PNG images.
1414//!
1515//! **NOTICE:** The proxy service is not intended to be used as a general
2020//! with the text "Sign in to see image" instead.
2121//!
2222//! # Example
23- //!
23+ //!
2424//! The PNG image:
25- //!
25+ //!
2626//! <https://raw.githubusercontent.com/torrust/torrust-index-backend/develop/docs/media/torrust_logo.png>
27- //!
27+ //!
2828//! The percent encoded image URL:
29- //!
29+ //!
3030//! ```text
3131//! https%3A%2F%2Fraw.githubusercontent.com%2Ftorrust%2Ftorrust-index-backend%2Fdevelop%2Fdocs%2Fmedia%2Ftorrust_logo.png
3232//! ```
You can’t perform that action at this time.
0 commit comments