文件名最多50字符
This commit is contained in:
@@ -8,8 +8,18 @@ class Document:
|
|||||||
def __init__(self,suffix:str,content:bytes,stem:str|None=None,path:Path=None):
|
def __init__(self,suffix:str,content:bytes,stem:str|None=None,path:Path=None):
|
||||||
self.suffix=suffix
|
self.suffix=suffix
|
||||||
self.content=content
|
self.content=content
|
||||||
self.stem=stem
|
self._stem=stem
|
||||||
self.path=path
|
self.path=path
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def stem(self)->str|None:
|
||||||
|
if not self._stem:
|
||||||
|
return None
|
||||||
|
if len(self._stem)>50:
|
||||||
|
return self._stem[:50]+self.suffix
|
||||||
|
return self._stem+self.suffix
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self)->str|None:
|
def name(self)->str|None:
|
||||||
if not self.stem:
|
if not self.stem:
|
||||||
|
|||||||
Reference in New Issue
Block a user