File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 11import { createHash } from "crypto" ;
2+ import { join } from "node:path" ;
23
34import { projects } from "@cocalc/backend/data" ;
45import { is_valid_uuid_string } from "@cocalc/util/misc" ;
@@ -74,5 +75,11 @@ export function envForSpawn() {
7475
7576// return the absolute home directory of given @project_id project on disk
7677export function homePath ( project_id : string ) : string {
77- return projects . replace ( "[project_id]" , project_id ) ;
78+ // $MOUNTED_PROJECTS_ROOT is for OnPrem and that "projects" location is only for dev/single-user
79+ const projects_root = process . env . MOUNTED_PROJECTS_ROOT ;
80+ if ( projects_root ) {
81+ return join ( projects_root , project_id ) ;
82+ } else {
83+ return projects . replace ( "[project_id]" , project_id ) ;
84+ }
7885}
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ Code related to permanently deleting projects.
88*/
99
1010import { promises as fs } from "node:fs" ;
11- import { join } from "node:path" ;
1211
1312import { pathToFiles } from "@cocalc/backend/files/path-to-files" ;
1413import getLogger , { WinstonLogger } from "@cocalc/backend/logger" ;
@@ -301,12 +300,7 @@ async function deleteProjectFiles(
301300 L2 : WinstonLogger [ "debug" ] ,
302301 project_id : string ,
303302) {
304- // $MOUNTED_PROJECTS_ROOT is for OnPrem and homePath only works in dev/single-user
305- const projects_root =
306- process . env [ "MOUNTED_PROJECTS_ROOT" ] ?? homePath ( project_id ) ;
307- if ( ! projects_root ) return ;
308- const project_dir = join ( projects_root , project_id ) ;
309- L2 ( `attempting to delete all files in ${ project_dir } ` ) ;
303+ const project_dir = homePath ( project_id ) ;
310304 try {
311305 await fs . access ( project_dir , F_OK | R_OK | W_OK ) ;
312306 const stats = await fs . lstat ( project_dir ) ;
@@ -318,7 +312,7 @@ async function deleteProjectFiles(
318312 }
319313 } catch ( err ) {
320314 L2 (
321- `not deleting project files: either path does not exist or is not accessible` ,
315+ `not deleting project files: either ' ${ project_dir } ' does not exist or is not accessible` ,
322316 ) ;
323317 }
324318}
You can’t perform that action at this time.
0 commit comments