Changeset - c5bed2ab87a7
[Not reviewed]
stable
0 1 0
Mads Kiilerich (mads) - 13 months ago 2025-02-18 13:02:17
mads@kiilerich.com
Grafted from: 98693b531d90
vcs: Always return node content as bytes

is_binary would fail to find nul bytes in unicode strings.
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/nodes.py
Show inline comments
 
@@ -259,24 +259,26 @@ class FileNode(Node):
 
            mode = self._mode
 
        return mode
 

	
 
    @property
 
    def content(self):
 
        """
 
        Returns lazily byte content of the FileNode.
 
        """
 
        if self.changeset:
 
            content = self.changeset.get_file_content(self.path)
 
        else:
 
            content = self._content
 
        if content is not None:
 
            content = safe_bytes(content)
 
        return content
 

	
 
    @LazyProperty
 
    def size(self):
 
        if self.changeset:
 
            return self.changeset.get_file_size(self.path)
 
        raise NodeError("Cannot retrieve size of the file without related "
 
            "changeset attribute")
 

	
 
    @LazyProperty
 
    def message(self):
 
        if self.changeset:
0 comments (0 inline, 0 general)