File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
graph/src/components/link_resolver Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,14 @@ impl FileLinkResolver {
4949 }
5050}
5151
52+ pub fn remove_prefix ( link : & str ) -> & str {
53+ if link. starts_with ( "/ipfs/" ) {
54+ & link[ 6 ..] // Skip the "/ipfs/" prefix (6 characters)
55+ } else {
56+ link
57+ }
58+ }
59+
5260#[ async_trait]
5361impl LinkResolverTrait for FileLinkResolver {
5462 fn with_timeout ( & self , timeout : Duration ) -> Box < dyn LinkResolverTrait > {
@@ -62,9 +70,10 @@ impl LinkResolverTrait for FileLinkResolver {
6270 }
6371
6472 async fn cat ( & self , logger : & Logger , link : & Link ) -> Result < Vec < u8 > , Error > {
65- let path = self . resolve_path ( & link. link ) ;
73+ let link = remove_prefix ( & link. link ) ;
74+ let path = self . resolve_path ( & link) ;
6675
67- slog:: trace !( logger, "File resolver: reading file" ;
76+ slog:: debug !( logger, "File resolver: reading file" ;
6877 "path" => path. to_string_lossy( ) . to_string( ) ) ;
6978
7079 match tokio:: fs:: read ( & path) . await {
You can’t perform that action at this time.
0 commit comments