File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -98,14 +98,17 @@ async def read_multiple_ranges(
98
98
with open (file_path , "r" , encoding = "utf-8" ) as f :
99
99
lines = f .readlines ()
100
100
total_lines = len (lines )
101
+ file_content = "" .join (lines )
102
+ file_hash = self .calculate_hash (file_content )
101
103
102
104
for range_spec in file_range ["ranges" ]:
103
105
# Adjust line numbers to 0-based index
104
106
line_start = max (1 , range_spec ["start" ]) - 1
107
+ end_value = range_spec .get ("end" )
105
108
line_end = (
106
109
total_lines
107
- if range_spec [ "end" ] is None
108
- else min (range_spec [ "end" ] , total_lines )
110
+ if end_value is None
111
+ else min (end_value , total_lines )
109
112
)
110
113
111
114
if line_start >= total_lines :
@@ -125,7 +128,7 @@ async def read_multiple_ranges(
125
128
"content" : content ,
126
129
"start_line" : line_start + 1 ,
127
130
"end_line" : line_end ,
128
- "hash" : self . calculate_hash ( content ) ,
131
+ "hash" : file_hash ,
129
132
"total_lines" : total_lines ,
130
133
"content_size" : len (content ),
131
134
}
You can’t perform that action at this time.
0 commit comments