##// END OF EJS Templates
api: fixed unicode problems on get_node, and ensure no cached items are used if cache=false
marcink -
r3488:4bcd6578 default
parent child Browse files
Show More
@@ -623,18 +623,26 b' class ScmModel(BaseModel):'
623 623 "size": size,
624 624 })
625 625
626 if content:
627 over_size_limit = (max_file_bytes is not None
628 and file_node.size > max_file_bytes)
626 if content and cache:
627 # get content + cache
628 size = file_node.size
629 over_size_limit = (max_file_bytes is not None and size > max_file_bytes)
629 630 full_content = None
630 631 if not file_node.is_binary and not over_size_limit:
631 if cache:
632 full_content = safe_str(file_node.content)
633 else:
632 full_content = safe_unicode(file_node.content)
633
634 file_data.update({
635 "content": full_content,
636 })
637 elif content:
638 # get content *without* cache
634 639 if _content is None:
635 is_binary, md5, size, _content = \
636 file_node.metadata_uncached()
637 full_content = safe_str(_content)
640 is_binary, md5, size, _content = file_node.metadata_uncached()
641
642 over_size_limit = (max_file_bytes is not None and size > max_file_bytes)
643 full_content = None
644 if not is_binary and not over_size_limit:
645 full_content = safe_unicode(_content)
638 646
639 647 file_data.update({
640 648 "content": full_content,
General Comments 0
You need to be logged in to leave comments. Login now