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 {
49
49
}
50
50
}
51
51
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
+
52
60
#[ async_trait]
53
61
impl LinkResolverTrait for FileLinkResolver {
54
62
fn with_timeout ( & self , timeout : Duration ) -> Box < dyn LinkResolverTrait > {
@@ -62,9 +70,10 @@ impl LinkResolverTrait for FileLinkResolver {
62
70
}
63
71
64
72
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) ;
66
75
67
- slog:: trace !( logger, "File resolver: reading file" ;
76
+ slog:: debug !( logger, "File resolver: reading file" ;
68
77
"path" => path. to_string_lossy( ) . to_string( ) ) ;
69
78
70
79
match tokio:: fs:: read ( & path) . await {
You can’t perform that action at this time.
0 commit comments