Преглед изворни кода

Fix sorting for output files in PDF preview (#11267)

GitOrigin-RevId: 8e8c478c34bf5d58cdb5e44009b918d13ab6a104
Alf Eaton пре 3 година
родитељ
комит
f89361c02b
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      services/web/frontend/js/features/pdf-preview/util/file-list.js

+ 3 - 3
services/web/frontend/js/features/pdf-preview/util/file-list.js

@@ -34,14 +34,14 @@ export const buildFileList = (outputFiles, clsiServerId, compileGroup) => {
     // sort main files first, then alphabetical
     allFiles.sort((a, b) => {
       if (a.main && !b.main) {
-        return a
+        return -1
       }
 
       if (b.main && !a.main) {
-        return b
+        return 1
       }
 
-      return a.path.localeCompare(b.path)
+      return a.path.localeCompare(b.path, undefined, { numeric: true })
     })
 
     // group files into "top" and "other"