File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ pub async fn get(
1515 . map_err ( |_| NotFound ( "Post not found" ) ) ?
1616 . ok_or_else ( || NotFound ( "Post not found" ) ) ?;
1717
18- filepath. push ( format ! ( "{} .html", slug ) ) ;
18+ filepath. push ( "post .html") ;
1919
2020 NamedFile :: open ( filepath)
2121 . await
Original file line number Diff line number Diff line change @@ -87,10 +87,13 @@ pub async fn post(
8787 . await
8888 . map_err ( |_| BadRequest ( "Failed to persist archive file" . to_owned ( ) ) ) ?;
8989
90- let meta = compiler:: compile (
90+ let details = compiler:: compile (
9191 & compiler:: options:: Options {
9292 output : std:: path:: Path :: new ( & output_dir) ,
9393 trim_rootdir : true ,
94+ garnish_html : true ,
95+ minify_html : true ,
96+ minify_css : true ,
9497 } ,
9598 & archive_path,
9699 )
@@ -101,7 +104,7 @@ pub async fn post(
101104 t. insert_post_metadata ( & PostMetadata {
102105 author_id : user. id ,
103106 author_username : ( & user. username ) . into ( ) ,
104- slug : ( & meta. slug ) . into ( ) ,
107+ slug : ( & details . meta . slug ) . into ( ) ,
105108 filepath : ( & output_dir) . into ( ) ,
106109 } )
107110 . await
@@ -112,7 +115,7 @@ pub async fn post(
112115 BadRequest ( "Oops" . into ( ) )
113116 } ) ?;
114117
115- let url = format ! ( "{}/~{}/{}" , env:: get( ) . host, user. username, meta. slug) ;
118+ let url = format ! ( "{}/~{}/{}" , env:: get( ) . host, user. username, details . meta. slug) ;
116119
117120 Ok ( Created :: new ( url) . body ( "Uploaded successfully!" . to_owned ( ) ) )
118121}
You can’t perform that action at this time.
0 commit comments