14
14
import tornado
15
15
import tornado .locks
16
16
from nbdime import diff_notebooks
17
+ from jupyter_server .utils import ensure_async
17
18
18
19
from .log import get_logger
19
20
@@ -1186,13 +1187,15 @@ async def show(self, filename, ref, path):
1186
1187
)
1187
1188
)
1188
1189
1189
- def get_content (self , contents_manager , filename , path ):
1190
+ async def get_content (self , contents_manager , filename , path ):
1190
1191
"""
1191
1192
Get the file content of filename.
1192
1193
"""
1193
1194
relative_repo = os .path .relpath (path , contents_manager .root_dir )
1194
1195
try :
1195
- model = contents_manager .get (path = os .path .join (relative_repo , filename ))
1196
+ model = await ensure_async (
1197
+ contents_manager .get (path = os .path .join (relative_repo , filename ))
1198
+ )
1196
1199
except tornado .web .HTTPError as error :
1197
1200
# Handle versioned file being deleted case
1198
1201
if error .status_code == 404 and error .log_message .startswith (
@@ -1210,7 +1213,7 @@ async def get_content_at_reference(
1210
1213
"""
1211
1214
if "special" in reference :
1212
1215
if reference ["special" ] == "WORKING" :
1213
- content = self .get_content (contents_manager , filename , path )
1216
+ content = await self .get_content (contents_manager , filename , path )
1214
1217
elif reference ["special" ] == "INDEX" :
1215
1218
is_binary = await self ._is_binary (filename , "INDEX" , path )
1216
1219
if is_binary :
0 commit comments