fix: don't crash and stay stuck on a subdir markdown link

Clicking a markdown link into a subdirectory's README threw
"Cannot read properties of undefined (reading 'sha')" and left the
viewer on Loading…. The route handler called updateContent() without
loading the new directory's file listing, so getSelectedFile() returned
undefined and getContent() then dereferenced fileInfo.sha.

Two fixes:
- getContent() falls back to sha "0" when fileInfo is undefined.
- The $routeUpdate handler walks the new path and loads any directory
  listings that aren't yet in $scope.files before rendering, so the
  selected file actually has its sha by the time we fetch.

Fixes #510.
This commit is contained in:
tdurieux
2026-05-04 11:10:12 +02:00
parent 117406f2ce
commit 5c7eb23336
2 changed files with 23 additions and 4 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long