@@ -42,7 +42,7 @@ use actix_web::{
4242 dev:: { ServerHandle , ServiceFactory , ServiceRequest } ,
4343 error:: Error ,
4444 get,
45- http:: header:: ContentType ,
45+ http:: header:: { ContentType , DispositionType } ,
4646 web,
4747} ;
4848use actix_ws:: AggregatedMessage ;
@@ -70,9 +70,6 @@ use tokio::{
7070 time:: sleep,
7171} ;
7272use url:: Url ;
73- use vscode:: {
74- serve_vscode_fs, vscode_client_framework, vscode_client_websocket, vscode_ide_websocket,
75- } ;
7673
7774// ### Local
7875//use crate::capture::EventCapture;
@@ -83,6 +80,9 @@ use filewatcher::{
8380 filewatcher_browser_endpoint, filewatcher_client_endpoint, filewatcher_root_fs_redirect,
8481 filewatcher_websocket,
8582} ;
83+ use vscode:: {
84+ serve_vscode_fs, vscode_client_framework, vscode_client_websocket, vscode_ide_websocket,
85+ } ;
8686
8787// Data structures
8888// ---------------
@@ -585,7 +585,14 @@ pub async fn filesystem_endpoint(
585585 }
586586 SimpleHttpResponse :: Bin ( path) => {
587587 match actix_files:: NamedFile :: open_async ( & path) . await {
588- Ok ( v) => v. into_response ( req) ,
588+ Ok ( mut v) => {
589+ if path. extension ( ) . is_some_and ( |ext| ext == "pdf" ) {
590+ let mut cd = v. content_disposition ( ) . clone ( ) ;
591+ cd. disposition = DispositionType :: Inline ;
592+ v = v. set_content_disposition ( cd) ;
593+ }
594+ v. into_response ( req)
595+ }
589596 Err ( err) => html_not_found ( & format ! ( "<p>Error opening file {path:?}: {err}." , ) ) ,
590597 }
591598 }
0 commit comments