File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ def is_chunk_id_segment(self):
74
74
def is_manifest_id_segment (self ):
75
75
return self ._tlv_type == self .__T_MANIFESTID
76
76
77
+
77
78
class Name (TlvType ):
78
79
__T_NAME = 0x0000
79
80
@@ -115,7 +116,8 @@ def __getitem__(self, index):
115
116
return v .decode ('UTF-8' )
116
117
117
118
def as_uri (self ):
118
- return 'ccnx:/' + '/' .join ([f'{ c .type ()} ={ c .value ()} ' for c in self ._components ])
119
+ # return 'ccnx:/' + '/'.join([f'{c.type()}={repr(c.value())}' for c in self._components])
120
+ return 'ccnx:/' + '/' .join ([repr (c ) for c in self ._components ])
119
121
120
122
def append (self , component : NameComponent ):
121
123
"""
Original file line number Diff line number Diff line change 18
18
from array import array
19
19
from pathlib import PurePath , Path
20
20
from typing import Optional , Dict
21
+ from urllib .parse import urlparse
21
22
22
23
from .SizedPointer import SizedPointer
23
24
from ..tlvs .Locators import Locators
@@ -38,8 +39,12 @@ class TreeIO:
38
39
39
40
@staticmethod
40
41
def get_link_name (name : Name ) -> str :
41
- name_bytes = name .serialize ().tobytes ()
42
- return f'{ name_bytes .hex ()} .link'
42
+ url = urlparse (name .as_uri ())
43
+ filename = url .path
44
+ safename = filename .replace ('/' ,'~' )
45
+ return f'{ safename } .link'
46
+ # name_bytes = name.serialize().tobytes()
47
+ # return f'{name_bytes.hex()}.link'
43
48
44
49
class DataBuffer :
45
50
def __init__ (self ):
You can’t perform that action at this time.
0 commit comments