File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
src/packages/frontend/frame-editors/latex-editor Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 11/*
2- * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
2+ * This file is part of CoCalc: Copyright © 2020-2025 Sagemath, Inc.
33 * License: MS-RSL – see LICENSE.md for details
44 */
55
@@ -33,18 +33,26 @@ export async function sagetex_hash(
3333 const { base, directory } = parse_path ( path ) ; // base, directory, filename
3434 const s = sagetex_file ( base ) ;
3535 status ( `sha1sum ${ s } ` ) ;
36+
37+ // Check if file exists and compute hash only if it does; otherwise return unique value
3638 const output = await exec (
3739 {
3840 timeout : 10 ,
39- command : " sha1sum" ,
40- args : [ s ] ,
41+ command : `test -f ${ s } && sha1sum ${ s } || true` ,
42+ bash : true ,
4143 project_id : project_id ,
4244 path : output_directory || directory ,
43- err_on_exit : true ,
45+ err_on_exit : false ,
4446 aggregate : time ,
4547 } ,
4648 path ,
4749 ) ;
50+
51+ // If file doesn't exist, return unique timestamp-based value to ensure rebuild
52+ if ( ! output . stdout . trim ( ) ) {
53+ return `missing-${ Date . now ( ) } ` ;
54+ }
55+
4856 return output . stdout . split ( " " ) [ 0 ] ;
4957}
5058
You can’t perform that action at this time.
0 commit comments