##// 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 "size": size,
623 "size": size,
624 })
624 })
625
625
626 if content:
626 if content and cache:
627 over_size_limit = (max_file_bytes is not None
627 # get content + cache
628 and file_node.size > max_file_bytes)
628 size = file_node.size
629 over_size_limit = (max_file_bytes is not None and size > max_file_bytes)
629 full_content = None
630 full_content = None
630 if not file_node.is_binary and not over_size_limit:
631 if not file_node.is_binary and not over_size_limit:
631 if cache:
632 full_content = safe_unicode(file_node.content)
632 full_content = safe_str(file_node.content)
633
633 else:
634 file_data.update({
635 "content": full_content,
636 })
637 elif content:
638 # get content *without* cache
634 if _content is None:
639 if _content is None:
635 is_binary, md5, size, _content = \
640 is_binary, md5, size, _content = file_node.metadata_uncached()
636 file_node.metadata_uncached()
641
637 full_content = safe_str(_content)
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 file_data.update({
647 file_data.update({
640 "content": full_content,
648 "content": full_content,
General Comments 0
You need to be logged in to leave comments. Login now